forked from madari/go-socket.io
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.go
56 lines (44 loc) · 1.25 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package socketio
import (
"log"
"time"
)
// Config represents a set of configurable settings used by the server
type Config struct {
// Maximum number of connections.
MaxConnections int
// Maximum amount of messages to store for a connection. If a connection
// has QueueLength amount of undelivered messages, the following Sends will
// return ErrQueueFull error.
QueueLength int
// The size of the read buffer in bytes.
ReadBufferSize int
// The interval between heartbeats
HeartbeatInterval time.Duration
// Period in ns during which the client must reconnect or it is considered
// disconnected.
ReconnectTimeout time.Duration
// Origins to allow for cross-domain requests.
// For example: ["localhost:8080", "myblog.com:*"].
Origins []string
// Transports to use.
Transports []Transport
// Codec to use.
Codec Codec
// The resource to bind to, e.g. /socket.io/
Resource string
// Logger to use.
Logger *log.Logger
}
var DefaultConfig = Config{
MaxConnections: 0,
QueueLength: 10,
ReadBufferSize: 2048,
HeartbeatInterval: 10e9,
ReconnectTimeout: 10e9,
Origins: nil,
Transports: DefaultTransports,
Codec: SIOCodec{},
Resource: "/socket.io/",
Logger: DefaultLogger,
}