feat: remove some debug output

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2021-06-22 15:51:50 +08:00
parent 88e59231da
commit 293c69a605
2 changed files with 3 additions and 5 deletions

View File

@ -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)
}

View File

@ -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)
}