|
|
@ -6,7 +6,7 @@ import com.bx.imcommon.contant.RedisKey; |
|
|
import com.bx.imcommon.enums.IMCmdType; |
|
|
import com.bx.imcommon.enums.IMCmdType; |
|
|
import com.bx.imcommon.model.IMSendInfo; |
|
|
import com.bx.imcommon.model.IMSendInfo; |
|
|
import com.bx.imcommon.model.LoginInfo; |
|
|
import com.bx.imcommon.model.LoginInfo; |
|
|
import com.bx.imserver.netty.IMServerMap; |
|
|
import com.bx.imserver.netty.IMServerGroup; |
|
|
import com.bx.imserver.netty.UserChannelCtxMap; |
|
|
import com.bx.imserver.netty.UserChannelCtxMap; |
|
|
import com.bx.imserver.netty.ws.WebSocketServer; |
|
|
import com.bx.imserver.netty.ws.WebSocketServer; |
|
|
import io.netty.channel.ChannelHandlerContext; |
|
|
import io.netty.channel.ChannelHandlerContext; |
|
|
@ -50,7 +50,7 @@ public class LoginProcessor extends MessageProcessor<LoginInfo> { |
|
|
ctx.channel().attr(attr).set(0L); |
|
|
ctx.channel().attr(attr).set(0L); |
|
|
// 在redis上记录每个user的channelId,15秒没有心跳,则自动过期
|
|
|
// 在redis上记录每个user的channelId,15秒没有心跳,则自动过期
|
|
|
String key = RedisKey.IM_USER_SERVER_ID+loginInfo.getUserId(); |
|
|
String key = RedisKey.IM_USER_SERVER_ID+loginInfo.getUserId(); |
|
|
redisTemplate.opsForValue().set(key, IMServerMap.serverId, Constant.ONLINE_TIMEOUT_SECOND, TimeUnit.SECONDS); |
|
|
redisTemplate.opsForValue().set(key, IMServerGroup.serverId, Constant.ONLINE_TIMEOUT_SECOND, TimeUnit.SECONDS); |
|
|
// 响应ws
|
|
|
// 响应ws
|
|
|
IMSendInfo sendInfo = new IMSendInfo(); |
|
|
IMSendInfo sendInfo = new IMSendInfo(); |
|
|
sendInfo.setCmd(IMCmdType.LOGIN.code()); |
|
|
sendInfo.setCmd(IMCmdType.LOGIN.code()); |
|
|
|