webSocket

This commit is contained in:
zhn
2022-06-07 18:00:42 +08:00
parent 73c9754540
commit 261b0e0f07
@@ -89,11 +89,13 @@ public class WebSocket {
public void pushMessage(String message) { public void pushMessage(String message) {
try { try {
for (WebSocket ws : webSockets) { for (WebSocket ws : webSockets) {
try { synchronized (ws.session){
ws.session.getBasicRemote().sendText(message); try {
} catch (IOException e) { ws.session.getBasicRemote().sendText(message);
e.printStackTrace(); } catch (IOException e) {
continue; e.printStackTrace();
continue;
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
@@ -152,4 +154,4 @@ public class WebSocket {
} }
} }
} }