-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package webreal | ||
|
||
import "time" | ||
|
||
// 客户端配置 | ||
type Config struct { | ||
WriteWait time.Duration // 写等待时间 | ||
WriteChanBuffer int // 写缓冲长度 | ||
PongWait time.Duration // 心跳等待时间 | ||
PingPeriod time.Duration // 心跳频率 | ||
MaxMessageSize int64 // 最大消息字节数 | ||
} | ||
|
||
func DefaultConfig() *Config { | ||
return &Config{ | ||
WriteWait: 10 * time.Second, | ||
WriteChanBuffer: 256, | ||
PongWait: 60 * time.Second, | ||
PingPeriod: 54 * time.Second, | ||
MaxMessageSize: 524288, // 512KB | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters