This commit is contained in:
wangliwen 2022-07-28 10:44:11 +08:00
parent 5eb0184bd4
commit ee1d2550d3
1 changed files with 5 additions and 5 deletions

View File

@ -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);
});
}
/**