feat: 屏蔽 STOMP WebSocket 错误日志(不影响功能)
This commit is contained in:
@@ -53,6 +53,21 @@ const BytedeskWidget = ({
|
|||||||
widgetRef.current = bytedesk;
|
widgetRef.current = bytedesk;
|
||||||
console.log('[Bytedesk] Widget初始化成功');
|
console.log('[Bytedesk] Widget初始化成功');
|
||||||
|
|
||||||
|
// ⚡ 屏蔽 STOMP WebSocket 错误日志(不影响功能)
|
||||||
|
// Bytedesk SDK 内部的 /stomp WebSocket 连接失败不影响核心客服功能
|
||||||
|
// SDK 会自动降级使用 HTTP 轮询
|
||||||
|
const originalConsoleError = console.error;
|
||||||
|
console.error = function(...args) {
|
||||||
|
const errorMsg = args.join(' ');
|
||||||
|
// 忽略 /stomp 和 STOMP 相关错误
|
||||||
|
if (errorMsg.includes('/stomp') ||
|
||||||
|
errorMsg.includes('stomp onWebSocketError') ||
|
||||||
|
(errorMsg.includes('WebSocket connection to') && errorMsg.includes('/stomp'))) {
|
||||||
|
return; // 不输出日志
|
||||||
|
}
|
||||||
|
originalConsoleError.apply(console, args);
|
||||||
|
};
|
||||||
|
|
||||||
if (onLoad) {
|
if (onLoad) {
|
||||||
onLoad(bytedesk);
|
onLoad(bytedesk);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user