aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/configuration')
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
index 409734e4..1781f5a6 100644
--- a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
+++ b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
@@ -7,6 +7,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
+import org.springframework.web.socket.client.WebSocketConnectionManager;
+import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import javax.inject.Inject;
@@ -28,4 +30,18 @@ public class ApiAppConfiguration {
public TGBot tgBot() {
return new TGBot(env.getProperty("telegram_token", StringUtils.EMPTY));
}
+
+ private static final String WS_URI = "wss://ws.juick.com/";
+
+ @Bean
+ public WebSocketConnectionManager connectionManager() {
+ WebSocketConnectionManager manager = new WebSocketConnectionManager(client(), tgBot(), WS_URI);
+ manager.setAutoStartup(true);
+ return manager;
+ }
+
+ @Bean
+ public StandardWebSocketClient client() {
+ return new StandardWebSocketClient();
+ }
}