Skip to content

Commit

Permalink
✨ Introducing new features.服务端心跳检测2
Browse files Browse the repository at this point in the history
  • Loading branch information
crossoverJie committed Jan 6, 2019
1 parent a96bbce commit 567058b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
ctx.writeAndFlush(heartBeat).addListeners(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
//下线客户端
CIMUserInfo userInfo = SessionSocketHolder.getUserId((NioSocketChannel) future.channel());
if (!future.isSuccess()) {
//下线客户端
CIMUserInfo userInfo = SessionSocketHolder.getUserId((NioSocketChannel) future.channel());

LOGGER.info("向客户端{}下发心跳成功",userInfo.getUserName());

userOffLine(userInfo, (NioSocketChannel) future.channel());
future.channel().close();
}else {
LOGGER.info("向客户端{}下发心跳失败",userInfo.getUserName());
}
}
});
Expand Down

0 comments on commit 567058b

Please sign in to comment.