Netty SimpleChannelInboundHandler close channel
java, netty, websocket
Solution
You should use `channelInactive()` which is triggered when a channel cannot perform communication anymore. `channelUnregistered()` has different meaning although `channelUnregistered()` is always triggered after `channelInactive()`.
Problem
I have handler that extends SimpleChannelInboundHandler. I use it for handling websocket frames. What is the best way to detect that connection was closed from client side (for browser closed or network connection crashed)? I see there are two methods in ChannelInboundHandlerAdapter: channelUnregistered and channelInactive. Can I use its for detectiong channel closing?