mirror of https://gitee.com/stylefeng/roses
判断wsurl 不为空
parent
b3da7f3139
commit
c08308a7d4
|
@ -76,10 +76,15 @@ public class WebSocketManager {
|
||||||
* @date 2021/1/24 22:11
|
* @date 2021/1/24 22:11
|
||||||
*/
|
*/
|
||||||
public static void sendMessage(Long userId, String message) {
|
public static void sendMessage(Long userId, String message) {
|
||||||
for(Session userSession: getSessionByUserId(userId)){
|
List<Session> sessionList = getSessionByUserId(userId);
|
||||||
|
// 增加判断不为空
|
||||||
|
if (!CollectionUtils.isEmpty(sessionList)) {
|
||||||
|
for (Session userSession : sessionList) {
|
||||||
userSession.getAsyncRemote().sendText(message);
|
userSession.getAsyncRemote().sendText(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue