forked from olahol/melody
/
config.go
22 lines (19 loc) · 887 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package melody
import "time"
// Config melody configuration struct.
type Config struct {
WriteWait time.Duration // Milliseconds until write times out.
PongWait time.Duration // Timeout for waiting on pong.
PingPeriod time.Duration // Milliseconds between pings.
MaxMessageSize int64 // Maximum size in bytes of a message.
MessageBufferSize int // The max amount of messages that can be in a sessions buffer before it starts dropping them.
}
func newConfig() *Config {
return &Config{
WriteWait: 10 * time.Second,
PongWait: (14 * 24 * time.Hour), // Because some browsers no ping pong, so we don't do this.
PingPeriod: (14 * 24 * time.Hour), // Because some browsers no ping pong, so we don't do this.
MaxMessageSize: 2048, // 512 is something tiny.
MessageBufferSize: 256,
}
}