forked from madari/go-socket.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
49 lines (38 loc) · 1.13 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
package socketio
import "log"
// 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 int64
// Period in ns during which the client must reconnect or it is considered
// disconnected.
ReconnectTimeout int64
// 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
// 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{},
Logger: DefaultLogger,
}