From 9ff710d38c569b89b8a3de42c474d2ed34cd4ba9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 2 Nov 2017 14:55:11 +0300 Subject: api: only ping method is enough --- juick-api/src/main/java/com/juick/api/ApiServer.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'juick-api/src/main/java/com/juick') diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java index 83e21e22..f4dd4d99 100644 --- a/juick-api/src/main/java/com/juick/api/ApiServer.java +++ b/juick-api/src/main/java/com/juick/api/ApiServer.java @@ -114,16 +114,11 @@ public class ApiServer implements ApplicationListener, AutoCl logger.warn("attachment error", e1); } } - @Scheduled(fixedRate = 60000) - public void reconnectWebsocket() { - if (!webSocketConnectionManager.isRunning()) { - logger.info("retrying..."); - webSocketConnectionManager.stop(); - webSocketConnectionManager.start(); - } - } + @Override public void onApplicationEvent(@Nonnull DisconnectedEvent event) { - reconnectWebsocket(); + logger.info("retrying..."); + webSocketConnectionManager.stop(); + webSocketConnectionManager.start(); } } -- cgit v1.2.3