From c875f208a6af4bf676022cd4b55b5c9624141a78 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 10 Apr 2018 14:42:13 +0300 Subject: websocket: do not ping closed sessions --- juick-server/src/main/java/com/juick/server/WebsocketManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'juick-server/src/main/java/com') 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); } -- cgit v1.2.3