正在显示
4 个修改的文件
包含
8 行增加
和
8 行删除
| @@ -112,7 +112,7 @@ public class CIMClient { | @@ -112,7 +112,7 @@ public class CIMClient { | ||
| 112 | LOGGER.error("连接失败", e); | 112 | LOGGER.error("连接失败", e); |
| 113 | } | 113 | } |
| 114 | if (future.isSuccess()) { | 114 | if (future.isSuccess()) { |
| 115 | - echoService.echo("start cim client success!"); | 115 | + echoService.echo("Start cim client success!"); |
| 116 | LOGGER.info("启动 cim client 成功"); | 116 | LOGGER.info("启动 cim client 成功"); |
| 117 | } | 117 | } |
| 118 | channel = (SocketChannel) future.channel(); | 118 | channel = (SocketChannel) future.channel(); |
| @@ -8,7 +8,7 @@ swagger.enable = true | @@ -8,7 +8,7 @@ swagger.enable = true | ||
| 8 | 8 | ||
| 9 | logging.level.root=error | 9 | logging.level.root=error |
| 10 | 10 | ||
| 11 | -#消息记录存放路径 | 11 | +# 消息记录存放路径 |
| 12 | cim.msg.logger.path = /opt/logs/cim/ | 12 | cim.msg.logger.path = /opt/logs/cim/ |
| 13 | 13 | ||
| 14 | 14 | ||
| @@ -45,7 +45,7 @@ cim.server.online.user.url=http://localhost:8083/onlineUser | @@ -45,7 +45,7 @@ cim.server.online.user.url=http://localhost:8083/onlineUser | ||
| 45 | cim.clear.route.request.url=http://localhost:8083/offLine | 45 | cim.clear.route.request.url=http://localhost:8083/offLine |
| 46 | 46 | ||
| 47 | # 客户端唯一ID | 47 | # 客户端唯一ID |
| 48 | -cim.user.id=1566914867344 | 48 | +cim.user.id=1586617710861 |
| 49 | cim.user.userName=zhangsan | 49 | cim.user.userName=zhangsan |
| 50 | 50 | ||
| 51 | # 回调线程队列大小 | 51 | # 回调线程队列大小 |
| @@ -49,7 +49,7 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto | @@ -49,7 +49,7 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto | ||
| 49 | //可能出现业务判断离线后再次触发 channelInactive | 49 | //可能出现业务判断离线后再次触发 channelInactive |
| 50 | CIMUserInfo userInfo = SessionSocketHolder.getUserId((NioSocketChannel) ctx.channel()); | 50 | CIMUserInfo userInfo = SessionSocketHolder.getUserId((NioSocketChannel) ctx.channel()); |
| 51 | if (userInfo != null){ | 51 | if (userInfo != null){ |
| 52 | - LOGGER.warn("[{}]触发 channelInactive 掉线!",userInfo.getUserName()); | 52 | + LOGGER.warn("[{}] trigger channelInactive offline!",userInfo.getUserName()); |
| 53 | userOffLine(userInfo, (NioSocketChannel) ctx.channel()); | 53 | userOffLine(userInfo, (NioSocketChannel) ctx.channel()); |
| 54 | ctx.channel().close(); | 54 | ctx.channel().close(); |
| 55 | } | 55 | } |
| @@ -77,7 +77,7 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto | @@ -77,7 +77,7 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto | ||
| 77 | * @throws IOException | 77 | * @throws IOException |
| 78 | */ | 78 | */ |
| 79 | private void userOffLine(CIMUserInfo userInfo, NioSocketChannel channel) throws IOException { | 79 | private void userOffLine(CIMUserInfo userInfo, NioSocketChannel channel) throws IOException { |
| 80 | - LOGGER.info("用户[{}]下线", userInfo.getUserName()); | 80 | + LOGGER.info("account [{}] offline!", userInfo.getUserName()); |
| 81 | SessionSocketHolder.remove(channel); | 81 | SessionSocketHolder.remove(channel); |
| 82 | SessionSocketHolder.removeSession(userInfo.getUserId()); | 82 | SessionSocketHolder.removeSession(userInfo.getUserId()); |
| 83 | 83 |
| @@ -61,7 +61,7 @@ public class CIMServer { | @@ -61,7 +61,7 @@ public class CIMServer { | ||
| 61 | 61 | ||
| 62 | ChannelFuture future = bootstrap.bind().sync(); | 62 | ChannelFuture future = bootstrap.bind().sync(); |
| 63 | if (future.isSuccess()) { | 63 | if (future.isSuccess()) { |
| 64 | - LOGGER.info("启动 cim server 成功"); | 64 | + LOGGER.info("Start cim server success!!!"); |
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | 67 | ||
| @@ -85,7 +85,7 @@ public class CIMServer { | @@ -85,7 +85,7 @@ public class CIMServer { | ||
| 85 | NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId()); | 85 | NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId()); |
| 86 | 86 | ||
| 87 | if (null == socketChannel) { | 87 | if (null == socketChannel) { |
| 88 | - throw new NullPointerException("客户端[" + sendMsgReqVO.getUserId() + "]不在线!"); | 88 | + LOGGER.error("client {} offline!", sendMsgReqVO.getUserId()); |
| 89 | } | 89 | } |
| 90 | CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder() | 90 | CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder() |
| 91 | .setRequestId(sendMsgReqVO.getUserId()) | 91 | .setRequestId(sendMsgReqVO.getUserId()) |
| @@ -95,6 +95,6 @@ public class CIMServer { | @@ -95,6 +95,6 @@ public class CIMServer { | ||
| 95 | 95 | ||
| 96 | ChannelFuture future = socketChannel.writeAndFlush(protocol); | 96 | ChannelFuture future = socketChannel.writeAndFlush(protocol); |
| 97 | future.addListener((ChannelFutureListener) channelFuture -> | 97 | future.addListener((ChannelFutureListener) channelFuture -> |
| 98 | - LOGGER.info("服务端手动发送 Google Protocol 成功={}", sendMsgReqVO.toString())); | 98 | + LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString())); |
| 99 | } | 99 | } |
| 100 | } | 100 | } |
-
请 注册 或 登录 后发表评论