diff options
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/TelegramBotManager.java')
-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)); } } |