From ee1d2550d374513bbaaf0c287c50abb442999335 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 28 Jul 2022 10:44:11 +0800 Subject: [PATCH] ... --- .../main/java/io/renren/websocket/WebSocketServer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java b/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java index 39148c0d..dbb52de2 100644 --- a/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java +++ b/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java @@ -76,11 +76,11 @@ public class WebSocketServer { * @param message 消息内容 */ public void sendMessage(Long userId, MessageData message) { - servers.values().forEach(info -> { - if (userId.equals(info.getUserId())) { - sendMessage(info.getSession(), message); - } - }); + servers.values().stream() + .filter(index -> userId.equals(index.getUserId())) + .forEach(index -> { + sendMessage(index.getSession(), message); + }); } /**