websocket 增加多分组 fork https://github.com/olahol/melody
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
724 B
22 lines
724 B
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: 60 * time.Second,
|
|
PingPeriod: (60 * time.Second * 9) / 10,
|
|
MaxMessageSize: 512,
|
|
MessageBufferSize: 256,
|
|
}
|
|
}
|