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) {
try {
for (WebSocket ws : webSockets) {
try {
ws.session.getBasicRemote().sendText(message);
} catch (IOException e) {
e.printStackTrace();
continue;
synchronized (ws.session){
try {
ws.session.getBasicRemote().sendText(message);
} catch (IOException e) {
e.printStackTrace();
continue;
}
}
}
} catch (Exception e) {
@@ -152,4 +154,4 @@ public class WebSocket {
}
}
}
}