config增加心跳时间
This commit is contained in:
@@ -77,6 +77,9 @@ type DatabaseConfig struct {
|
||||
type WebSocketConfig struct {
|
||||
// Timeout WebSocket请求超时时间(秒)
|
||||
Timeout int `yaml:"timeout"`
|
||||
|
||||
// HeartbeatInterval 心跳检测间隔(秒), 如果超过这个时间没有消息往来系统会自动发送一个心跳包维持长链接
|
||||
HeartbeatInterval int `yaml:"heartbeat_interval"`
|
||||
}
|
||||
|
||||
// HeartbeatConfig 代表心跳配置
|
||||
@@ -130,12 +133,9 @@ func (c *Config) GetDatabaseConnectionString() string {
|
||||
)
|
||||
}
|
||||
|
||||
// GetWebSocketTimeout 获取WebSocket超时时间(秒)
|
||||
func (c *Config) GetWebSocketTimeout() int {
|
||||
if c.WebSocket.Timeout <= 0 {
|
||||
return 5 // 默认5秒超时
|
||||
}
|
||||
return c.WebSocket.Timeout
|
||||
// GetWebSocketConfig 获取WebSocket配置
|
||||
func (c *Config) GetWebSocketConfig() WebSocketConfig {
|
||||
return c.WebSocket
|
||||
}
|
||||
|
||||
// GetHeartbeatConfig 获取心跳配置
|
||||
|
||||
Reference in New Issue
Block a user