Commit 36972f21 by 段启岩

消息更新

parent 76ea9470
...@@ -68,7 +68,7 @@ public class SocketIOServiceImpl implements SocketIOService { ...@@ -68,7 +68,7 @@ public class SocketIOServiceImpl implements SocketIOService {
socketIOServer.addConnectListener(client -> { socketIOServer.addConnectListener(client -> {
String token = client.getHandshakeData().getSingleUrlParam("token"); String token = client.getHandshakeData().getSingleUrlParam("token");
log.info("new websocket connection, token is {}", token); log.debug("new websocket connection, token is {}", token);
// 若没有携带token, 则直接关闭webscoket连接 // 若没有携带token, 则直接关闭webscoket连接
if (null == token) { if (null == token) {
...@@ -86,7 +86,7 @@ public class SocketIOServiceImpl implements SocketIOService { ...@@ -86,7 +86,7 @@ public class SocketIOServiceImpl implements SocketIOService {
// 将session存入内存 // 将session存入内存
putClient(userId, client); putClient(userId, client);
log.info("user {} [{},{},{}] connected to the im server", userId, client.getSessionId(), client.getRemoteAddress(), client.getNamespace()); log.debug("user {} [{},{},{}] connected to the im server", userId, client.getSessionId(), client.getRemoteAddress(), client.getNamespace());
// client.sendEvent(PUSH_EVENT, "hello, 欢迎连接服务器!"); // client.sendEvent(PUSH_EVENT, "hello, 欢迎连接服务器!");
}); });
...@@ -99,17 +99,16 @@ public class SocketIOServiceImpl implements SocketIOService { ...@@ -99,17 +99,16 @@ public class SocketIOServiceImpl implements SocketIOService {
if (null != userId) { if (null != userId) {
Set<SocketIOClient> clients = CLIENT_MAP.get(userId); Set<SocketIOClient> clients = CLIENT_MAP.get(userId);
if (!CollectionUtils.isEmpty(clients)) { if (!CollectionUtils.isEmpty(clients)) {
log.info("before remove{}", clients); log.debug("before remove{}", clients);
log.info("remove{}", client); log.debug("remove{}", client);
clients.remove(client); clients.remove(client);
log.info("after remove{}", clients); log.debug("after remove{}", clients);
} }
} }
} }
}); });
socketIOServer.start(); socketIOServer.start();
System.out.println("SOCKET SERVER START.");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment