2020-08-26 13:27:00 -07:00
|
|
|
package melody
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
// Config melody configuration struct.
|
|
|
|
type Config struct {
|
2024-08-27 10:04:05 -07:00
|
|
|
WriteWait time.Duration // Duration until write times out.
|
|
|
|
PongWait time.Duration // Timeout for waiting on pong.
|
|
|
|
PingPeriod time.Duration // Duration 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.
|
|
|
|
ConcurrentMessageHandling bool // Handle messages from sessions concurrently.
|
2020-08-26 13:27:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func newConfig() *Config {
|
|
|
|
return &Config{
|
|
|
|
WriteWait: 10 * time.Second,
|
|
|
|
PongWait: 60 * time.Second,
|
2024-08-27 10:04:05 -07:00
|
|
|
PingPeriod: 54 * time.Second,
|
2020-08-26 13:27:00 -07:00
|
|
|
MaxMessageSize: 512,
|
|
|
|
MessageBufferSize: 256,
|
|
|
|
}
|
|
|
|
}
|