rpc: add separate size limit for websocket (#22385)
This makes the WebSocket message size limit independent of the limit used for HTTP requests. The new limit for WebSocket messages is 15MB.
This commit is contained in:
@ -37,6 +37,7 @@ const (
|
||||
wsWriteBuffer = 1024
|
||||
wsPingInterval = 60 * time.Second
|
||||
wsPingWriteTimeout = 5 * time.Second
|
||||
wsMessageSizeLimit = 15 * 1024 * 1024
|
||||
)
|
||||
|
||||
var wsBufferPool = new(sync.Pool)
|
||||
@ -239,7 +240,7 @@ type websocketCodec struct {
|
||||
}
|
||||
|
||||
func newWebsocketCodec(conn *websocket.Conn) ServerCodec {
|
||||
conn.SetReadLimit(maxRequestContentLength)
|
||||
conn.SetReadLimit(wsMessageSizeLimit)
|
||||
wc := &websocketCodec{
|
||||
jsonCodec: NewFuncCodec(conn, conn.WriteJSON, conn.ReadJSON).(*jsonCodec),
|
||||
conn: conn,
|
||||
|
Reference in New Issue
Block a user