package com.juick.server.component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; import org.springframework.web.socket.client.WebSocketConnectionManager; import javax.inject.Inject; @Component public class JuickServerReconnectManager implements ApplicationListener { private static Logger logger = LoggerFactory.getLogger(JuickServerReconnectManager.class); @Inject private WebSocketConnectionManager webSocketConnectionManager; @Override public void onApplicationEvent(DisconnectedEvent event) { logger.info("retrying..."); webSocketConnectionManager.stop(); webSocketConnectionManager.start(); } }