webSocket

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