62,614
社区成员
发帖
与我相关
我的任务
分享
io.netty.channel.ChannelHandlerAdapter#handlerRemoved#handlerRemoved
io.netty.channel.ChannelHandlerAdapter#handlerRemoved#exceptionCaught
io.netty.channel.ChannelHandlerAdapter#handlerRemoved#userEventTriggered
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
super.userEventTriggered(ctx, evt);
if (evt instanceof IdleStateEvent) {
IdleStateEvent event = (IdleStateEvent) evt;
if (event.state().equals(IdleState.READER_IDLE)) {
ctx.close();
//标志该链接已经close 了
}
}
在这三个地方标记 该链接已经close 了 在发送的时候检查如果该用户已经offline了 就不用发送了[麻烦把6楼删掉]com.jiemoapp.push.server.handler.AuthHandlerAdapter#handlerRemoved
com.jiemoapp.push.server.handler.AuthHandlerAdapter#exceptionCaught
com.jiemoapp.push.server.handler.AuthHandlerAdapter#userEventTriggered
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
super.userEventTriggered(ctx, evt);
if (evt instanceof IdleStateEvent) {
IdleStateEvent event = (IdleStateEvent) evt;
if (event.state().equals(IdleState.READER_IDLE)) {
ctx.close();
//标志该链接已经close 了
}
}
在这三个地方标记 该链接已经close 了 在发送的时候检查如果该用户已经offline了 就不用发送了