feat: 优化提示
This commit is contained in:
@@ -34,8 +34,15 @@ export class SignalingClient {
|
||||
// 记录关闭码和原因,便于诊断断连根因:
|
||||
// 1000 = 正常关闭, 1001 = 离开, 1006 = 异常断开(无 close frame)
|
||||
// 1009 = 消息过大, 1011 = 服务端异常
|
||||
console.warn('[信令] WebSocket 已关闭 code=%d reason=%s wasClean=%s',
|
||||
ev.code, ev.reason || '(无)', ev.wasClean);
|
||||
let hint = '';
|
||||
if (ev.code === 1009) {
|
||||
// 关闭帧由服务端发出:服务端 WebSocket 单条消息缓冲上限过小,
|
||||
// 导致 SDP/ICE 等稍大的消息被拒绝。需在信令服务端调大消息大小上限
|
||||
// (Spring 原生 WebSocket 用 configureWebSocketTransport#setMessageSizeLimit)。
|
||||
hint = '(消息过大:请检查信令服务端 WebSocket 的 messageSizeLimit 配置是否过小)';
|
||||
}
|
||||
console.warn('[信令] WebSocket 已关闭 code=%d reason=%s wasClean=%s%s',
|
||||
ev.code, ev.reason || '(无)', ev.wasClean, hint);
|
||||
this._stopHeartbeat();
|
||||
this.onDisconnected && this.onDisconnected(ev.code, ev.reason);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user