Commit add3ed07 authored by daniel's avatar daniel

fix(websocket): 解决推送多次的问题

parent 54b44882
......@@ -96,10 +96,11 @@ public class WebSocketSessionService {
String userId = ticketUserMap.get(ticketNo);
// 本地推送
sendLocal(ticketNo, message);
// if (userId == null) {
// 如果用户不存在该节点,发布到 Redis 同步
if (userId == null) {
// 发布到 Redis,让其他节点同步
redisTemplate.convertAndSend(topic.getTopic(), message.toJson());
// }
}
}
// 本地推送消息给客户
private void sendLocal(String ticketNo, WebSocketMessage message) {
......
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