Browse Source

fix bug

master
xsx 2 years ago
parent
commit
03435f6c00
  1. 2
      im-server/src/main/java/com/bx/imserver/netty/processor/LoginProcessor.java

2
im-server/src/main/java/com/bx/imserver/netty/processor/LoginProcessor.java

@ -62,7 +62,7 @@ public class LoginProcessor extends AbstractMessageProcessor<IMLoginInfo> {
AttributeKey<Integer> terminalAttr = AttributeKey.valueOf(ChannelAttrKey.TERMINAL_TYPE);
ctx.channel().attr(terminalAttr).set(terminal);
// 初始化心跳次数
AttributeKey<Long> heartBeatAttr = AttributeKey.valueOf("HEARTBEAt_TIMES");
AttributeKey<Long> heartBeatAttr = AttributeKey.valueOf(ChannelAttrKey.HEARTBEAT_TIMES);
ctx.channel().attr(heartBeatAttr).set(0L);
// 在redis上记录每个user的channelId,15秒没有心跳,则自动过期
String key = String.join(":", IMRedisKey.IM_USER_SERVER_ID, userId.toString(), terminal.toString());

Loading…
Cancel
Save