File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/main/java/com/xiaozhi/communication/server/websocket Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -118,13 +118,15 @@ public void afterConnectionClosed(org.springframework.web.socket.WebSocketSessio
118118
119119 @ Override
120120 public void handleTransportError (org .springframework .web .socket .WebSocketSession session , Throwable exception ) {
121+ String sessionId = session .getId ();
121122 // 检查是否是客户端正常关闭连接导致的异常
122123 if (isClientCloseRequest (exception )) {
123124 // 客户端主动关闭,记录为信息级别日志而非错误
124- logger .info ("WebSocket连接被客户端主动关闭 - SessionId: {}" , session .getId ());
125+ logger .info ("WebSocket连接被客户端主动关闭 - SessionId: {}" , sessionId );
126+ messageHandler .afterConnectionClosed (sessionId );
125127 } else {
126128 // 真正的传输错误
127- logger .error ("WebSocket传输错误 - SessionId: {}" , session . getId () , exception );
129+ logger .error ("WebSocket传输错误 - SessionId: {}" , sessionId , exception );
128130 }
129131 }
130132
You can’t perform that action at this time.
0 commit comments