perf: control ws write buffer (#1451)

Signed-off-by: rfyiamcool <rfyiamcool@163.com>
This commit is contained in:
fengyun.rui
2023-11-22 17:31:37 +08:00
committed by GitHub
parent 7a13284b2e
commit a9153afc38
5 changed files with 23 additions and 4 deletions
+8
View File
@@ -27,6 +27,8 @@ type (
handshakeTimeout time.Duration
// 允许消息最大长度
messageMaxMsgLength int
// websocket write buffer, default: 4096, 4kb.
writeBufferSize int
}
)
@@ -53,3 +55,9 @@ func WithMessageMaxMsgLength(length int) Option {
opt.messageMaxMsgLength = length
}
}
func WithWriteBufferSize(size int) Option {
return func(opt *configs) {
opt.writeBufferSize = size
}
}