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

37 lines
1.1 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package config
import "time"
type (
WSClientConf struct {
// Url 连接地址
Url string `json:",default=0.0.0.0:9876,env=WS_URL"`
// ReadBufferSize 读缓冲区大小
ReadBufferSize int `json:",default=2048"`
// WriteBufferSize 写缓冲区大小
WriteBufferSize int `json:",default=1024"`
// 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 {
WSClientConf
BackoffConf
}
)