Skip to content

Commit

Permalink
📝 Writing docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
crossoverJie committed Apr 11, 2020
1 parent 35e722c commit c309f8b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void startClient(CIMServerResVO.ServerInfo cimServer) {
LOGGER.error("连接失败", e);
}
if (future.isSuccess()) {
echoService.echo("start cim client success!");
echoService.echo("Start cim client success!");
LOGGER.info("启动 cim client 成功");
}
channel = (SocketChannel) future.channel();
Expand Down
4 changes: 2 additions & 2 deletions cim-client/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ swagger.enable = true

logging.level.root=error

#消息记录存放路径
# 消息记录存放路径
cim.msg.logger.path = /opt/logs/cim/


Expand Down Expand Up @@ -45,7 +45,7 @@ cim.server.online.user.url=http://localhost:8083/onlineUser
cim.clear.route.request.url=http://localhost:8083/offLine

# 客户端唯一ID
cim.user.id=1566914867344
cim.user.id=1586617710861
cim.user.userName=zhangsan

# 回调线程队列大小
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
//可能出现业务判断离线后再次触发 channelInactive
CIMUserInfo userInfo = SessionSocketHolder.getUserId((NioSocketChannel) ctx.channel());
if (userInfo != null){
LOGGER.warn("[{}]触发 channelInactive 掉线!",userInfo.getUserName());
LOGGER.warn("[{}] trigger channelInactive offline!",userInfo.getUserName());
userOffLine(userInfo, (NioSocketChannel) ctx.channel());
ctx.channel().close();
}
Expand Down Expand Up @@ -77,7 +77,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
* @throws IOException
*/
private void userOffLine(CIMUserInfo userInfo, NioSocketChannel channel) throws IOException {
LOGGER.info("用户[{}]下线", userInfo.getUserName());
LOGGER.info("account [{}] offline!", userInfo.getUserName());
SessionSocketHolder.remove(channel);
SessionSocketHolder.removeSession(userInfo.getUserId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void start() throws InterruptedException {

ChannelFuture future = bootstrap.bind().sync();
if (future.isSuccess()) {
LOGGER.info("启动 cim server 成功");
LOGGER.info("Start cim server success!!!");
}
}

Expand All @@ -85,7 +85,7 @@ public void sendMsg(SendMsgReqVO sendMsgReqVO){
NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());

if (null == socketChannel) {
throw new NullPointerException("客户端[" + sendMsgReqVO.getUserId() + "]不在线!");
LOGGER.error("client {} offline!", sendMsgReqVO.getUserId());
}
CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()
.setRequestId(sendMsgReqVO.getUserId())
Expand All @@ -95,6 +95,6 @@ public void sendMsg(SendMsgReqVO sendMsgReqVO){

ChannelFuture future = socketChannel.writeAndFlush(protocol);
future.addListener((ChannelFutureListener) channelFuture ->
LOGGER.info("服务端手动发送 Google Protocol 成功={}", sendMsgReqVO.toString()));
LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));
}
}

0 comments on commit c309f8b

Please sign in to comment.