aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server/src/main/java/com/juick/server/WebsocketManager.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/WebsocketManager.java b/juick-server/src/main/java/com/juick/server/WebsocketManager.java
index f55bd92b..4beb3190 100644
--- a/juick-server/src/main/java/com/juick/server/WebsocketManager.java
+++ b/juick-server/src/main/java/com/juick/server/WebsocketManager.java
@@ -166,7 +166,9 @@ public class WebsocketManager extends TextWebSocketHandler {
public void ping() {
clients.forEach(c -> {
try {
- c.session.sendMessage(new PingMessage());
+ if (c.session.isOpen()) {
+ c.session.sendMessage(new PingMessage());
+ }
} catch (IOException e) {
logger.error("WebSocket PING exception", e);
}