aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-11-02 14:43:00 +0300
committerGravatar Vitaly Takmazov2017-11-02 14:43:00 +0300
commit9a72efea7c78c7c16a80a411e001949949328b12 (patch)
tree48721c3904fd83f4f32acee9d690c89e9cd289a7 /juick-api/src/main/java/com/juick
parent8b48db63341bb0edf2273cb9f0bbdc8f84553bb7 (diff)
api: send disconnected event when ping
Diffstat (limited to 'juick-api/src/main/java/com/juick')
-rw-r--r--juick-api/src/main/java/com/juick/api/TelegramBotManager.java4
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));
}
}