|
|
@ -19,6 +19,8 @@ import java.util.List; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
import com.corundumstudio.socketio.protocol.Packet; |
|
|
|
import com.corundumstudio.socketio.protocol.PacketType; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
@ -138,12 +140,17 @@ public class WebSocketTransport extends ChannelInboundHandlerAdapter { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception { |
|
|
|
ClientHead client = clientsBox.get(ctx.channel()); |
|
|
|
final Channel channel = ctx.channel(); |
|
|
|
ClientHead client = clientsBox.get(channel); |
|
|
|
Packet packet = new Packet(PacketType.MESSAGE); |
|
|
|
if (client != null && client.isTransportChannel(ctx.channel(), Transport.WEBSOCKET)) { |
|
|
|
log.debug("channel inactive {}", client.getSessionId()); |
|
|
|
client.onChannelDisconnect(); |
|
|
|
} |
|
|
|
super.channelInactive(ctx); |
|
|
|
client.send(packet); |
|
|
|
channel.close(); |
|
|
|
ctx.close(); |
|
|
|
} |
|
|
|
|
|
|
|
private void handshake(ChannelHandlerContext ctx, final UUID sessionId, String path, FullHttpRequest req) { |
|
|
|