diff options
author | Vitaly Takmazov | 2017-11-02 14:43:00 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-11-02 14:43:00 +0300 |
commit | 9a72efea7c78c7c16a80a411e001949949328b12 (patch) | |
tree | 48721c3904fd83f4f32acee9d690c89e9cd289a7 /juick-api/src | |
parent | 8b48db63341bb0edf2273cb9f0bbdc8f84553bb7 (diff) |
api: send disconnected event when ping
Diffstat (limited to 'juick-api/src')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TelegramBotManager.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java index 44f0fdc6..f992d726 100644 --- a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java +++ b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java @@ -108,9 +108,11 @@ public class TelegramBotManager extends TextWebSocketHandler { @Scheduled(fixedRate = 30000) public void ping() throws IOException { - if (session != null) { + if (session != null && session.isOpen()) { logger.debug("Sending WebSocket ping"); session.sendMessage(new PingMessage()); + } else { + applicationEventPublisher.publishEvent(new DisconnectedEvent(this)); } } |