yun-zuoyi
wei.peng 6 years ago
commit b0bc7ecada

@ -82,12 +82,14 @@ public class MessageWebSocket {
public static void sendMessage(Long userId, String message){
try {
MessageWebSocket websocket = webSocketSet.get(userId);
if(websocket != null) {
if (message.equals("heartBit")) {
websocket.session.getBasicRemote().sendText(message + "=" + sendCount);
sendCount++;
} else {
websocket.session.getBasicRemote().sendText(message);
synchronized (websocket){
if(websocket != null) {
if (message.equals("heartBit")) {
websocket.session.getBasicRemote().sendText(message + "=" + sendCount);
sendCount++;
} else {
websocket.session.getBasicRemote().sendText(message);
}
}
}
} catch (IOException e) {

Loading…
Cancel
Save