@@ -33,7 +33,7 @@ class NettyWebSocketServer extends EventEmitter {
 | 
				
			|||||||
            let cid = ctx?.channel().id() + ''
 | 
					            let cid = ctx?.channel().id() + ''
 | 
				
			||||||
            if (this.clients.has(cid)) {
 | 
					            if (this.clients.has(cid)) {
 | 
				
			||||||
                this.emit(ServerEvent.message, this.clients.get(cid), msg.text())
 | 
					                this.emit(ServerEvent.message, this.clients.get(cid), msg.text())
 | 
				
			||||||
            } else {
 | 
					            } else if (global.debug) {
 | 
				
			||||||
                console.error(`unknow client ${ctx} reciver message ${msg.text()}`)
 | 
					                console.error(`unknow client ${ctx} reciver message ${msg.text()}`)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
@@ -41,7 +41,7 @@ class NettyWebSocketServer extends EventEmitter {
 | 
				
			|||||||
            let cid = ctx?.channel().id() + ''
 | 
					            let cid = ctx?.channel().id() + ''
 | 
				
			||||||
            if (this.clients.has(cid)) {
 | 
					            if (this.clients.has(cid)) {
 | 
				
			||||||
                this.emit(ServerEvent.disconnect, this.clients.get(cid), cause)
 | 
					                this.emit(ServerEvent.disconnect, this.clients.get(cid), cause)
 | 
				
			||||||
            } else {
 | 
					            } else if (global.debug) {
 | 
				
			||||||
                console.error(`unknow client ${ctx} disconnect cause ${cause}`)
 | 
					                console.error(`unknow client ${ctx} disconnect cause ${cause}`)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
@@ -49,7 +49,7 @@ class NettyWebSocketServer extends EventEmitter {
 | 
				
			|||||||
            let cid = ctx?.channel().id() + ''
 | 
					            let cid = ctx?.channel().id() + ''
 | 
				
			||||||
            if (this.clients.has(cid)) {
 | 
					            if (this.clients.has(cid)) {
 | 
				
			||||||
                this.emit(ServerEvent.error, this.clients.get(cid), cause)
 | 
					                this.emit(ServerEvent.error, this.clients.get(cid), cause)
 | 
				
			||||||
            } else {
 | 
					            } else if (global.debug) {
 | 
				
			||||||
                console.error(`unknow client ${ctx} cause error ${cause}`)
 | 
					                console.error(`unknow client ${ctx} cause error ${cause}`)
 | 
				
			||||||
                console.ex(cause)
 | 
					                console.ex(cause)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,13 +42,11 @@ export class WebSocketHandler extends WebSocketHandlerAdapter {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    channelInactive(ctx: any) {
 | 
					    channelInactive(ctx: any) {
 | 
				
			||||||
        console.debug('WebSocketHandler channelInactive ' + ctx)
 | 
					 | 
				
			||||||
        this.options.event.emit(ServerEvent.disconnect, ctx, 'netty channelInactive')
 | 
					        this.options.event.emit(ServerEvent.disconnect, ctx, 'netty channelInactive')
 | 
				
			||||||
        super.channelInactive(ctx)
 | 
					        super.channelInactive(ctx)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    channelUnregistered(ctx: any) {
 | 
					    channelUnregistered(ctx: any) {
 | 
				
			||||||
        console.debug('WebSocketHandler channelUnregistered ' + ctx)
 | 
					 | 
				
			||||||
        this.options.event.emit(ServerEvent.disconnect, ctx, 'netty channelUnregistered')
 | 
					        this.options.event.emit(ServerEvent.disconnect, ctx, 'netty channelUnregistered')
 | 
				
			||||||
        super.channelUnregistered(ctx)
 | 
					        super.channelUnregistered(ctx)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user