diff options
author | Vitaly Takmazov | 2018-04-10 14:42:13 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-10 14:42:13 +0300 |
commit | c875f208a6af4bf676022cd4b55b5c9624141a78 (patch) | |
tree | a8675ebcbf854f8e6a396164f2100fee2c8f9a94 /juick-server/src/main/java/com/juick/server | |
parent | 4d8842d3254886b1925015e0cd24005dd927dd2a (diff) |
websocket: do not ping closed sessions
Diffstat (limited to 'juick-server/src/main/java/com/juick/server')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/WebsocketManager.java | 4 |
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); } |