From 76ec6cd68f2697c1f36640f77a9cf0f3b01e761a Mon Sep 17 00:00:00 2001 From: buvidk <1532493290@qq.com> Date: Thu, 9 Jul 2026 02:55:42 +0800 Subject: [PATCH] fix(msggateway): use configured WebSocket message size --- internal/msggateway/ws_server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/msggateway/ws_server.go b/internal/msggateway/ws_server.go index 0f7e1f8e6..7fe286dd4 100644 --- a/internal/msggateway/ws_server.go +++ b/internal/msggateway/ws_server.go @@ -60,6 +60,7 @@ type WsServer struct { onlineUserNum atomic.Int64 onlineUserConnNum atomic.Int64 handshakeTimeout time.Duration + wsMaxMsgLength int64 writeBufferSize int validate *validator.Validate disCov discovery.Conn @@ -150,6 +151,7 @@ func NewWsServer(msgGatewayConfig *Config, opts ...Option) *WsServer { msgGatewayConfig: msgGatewayConfig, port: config.port, wsMaxConnNum: config.maxConnNum, + wsMaxMsgLength: int64(config.messageMaxMsgLength), writeBufferSize: config.writeBufferSize, handshakeTimeout: config.handshakeTimeout, clientPool: sync.Pool{ @@ -541,7 +543,7 @@ func (ws *WsServer) wsHandler(w http.ResponseWriter, r *http.Request) { } client := new(Client) - client.ResetClient(connContext, NewWebSocketClientConn(conn, maxMessageSize, pongWait, pingInterval), ws) + client.ResetClient(connContext, NewWebSocketClientConn(conn, ws.wsMaxMsgLength, pongWait, pingInterval), ws) // Register the client with the server and start message processing ws.registerChan <- client