diff --git a/packages/websocket/src/netty/index.ts b/packages/websocket/src/netty/index.ts index 0f7fe1ab..1432e5d7 100644 --- a/packages/websocket/src/netty/index.ts +++ b/packages/websocket/src/netty/index.ts @@ -33,7 +33,7 @@ class NettyWebSocketServer extends EventEmitter { let cid = ctx?.channel().id() + '' if (this.clients.has(cid)) { this.emit(ServerEvent.message, this.clients.get(cid), msg.text()) - } else { + } else if (global.debug) { console.error(`unknow client ${ctx} reciver message ${msg.text()}`) } }) @@ -41,7 +41,7 @@ class NettyWebSocketServer extends EventEmitter { let cid = ctx?.channel().id() + '' if (this.clients.has(cid)) { this.emit(ServerEvent.disconnect, this.clients.get(cid), cause) - } else { + } else if (global.debug) { console.error(`unknow client ${ctx} disconnect cause ${cause}`) } }) @@ -49,7 +49,7 @@ class NettyWebSocketServer extends EventEmitter { let cid = ctx?.channel().id() + '' if (this.clients.has(cid)) { this.emit(ServerEvent.error, this.clients.get(cid), cause) - } else { + } else if (global.debug) { console.error(`unknow client ${ctx} cause error ${cause}`) console.ex(cause) } diff --git a/packages/websocket/src/netty/websocket_handler.ts b/packages/websocket/src/netty/websocket_handler.ts index 812cc4e0..8ef10f5e 100644 --- a/packages/websocket/src/netty/websocket_handler.ts +++ b/packages/websocket/src/netty/websocket_handler.ts @@ -42,13 +42,11 @@ export class WebSocketHandler extends WebSocketHandlerAdapter { } channelInactive(ctx: any) { - console.debug('WebSocketHandler channelInactive ' + ctx) this.options.event.emit(ServerEvent.disconnect, ctx, 'netty channelInactive') super.channelInactive(ctx) } channelUnregistered(ctx: any) { - console.debug('WebSocketHandler channelUnregistered ' + ctx) this.options.event.emit(ServerEvent.disconnect, ctx, 'netty channelUnregistered') super.channelUnregistered(ctx) }