You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nnet/config/client_ws.go

33 lines
933 B
Go

package config
import "time"
type (
WSClientConf struct {
// ReadLimit 单条消息支持的最大消息长度,默认 8MB
ReadLimit int64 `json:",default=8192"`
// WriteDeadline 写超时默认5s
WriteDeadline time.Duration `json:",default=5s"`
// ReadDeadline 读超时,控制断线检测 默认60s
ReadDeadline time.Duration `json:",default=60s"`
}
// BackoffConf 自动重连配置
BackoffConf struct {
// MinRecTime 最小重连时间间隔 默认2s
MinRecTime time.Duration `json:",default=2s"`
// MaxRecTime 最大重连时间间隔 默认60s
MaxRecTime time.Duration `json:",default=60s"`
// RecFactor 每次重连失败继续重连的时间间隔递增的乘数因子,递增到最大重连时间间隔为止
RecFactor float64 `json:",default=1.5"`
}
// WSClientFullConf 完整的客户端配置
WSClientFullConf struct {
WSConf
WSClientConf
BackoffConf
WSEvent `json:"-"`
}
)