aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/configuration
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-01-12 17:47:11 +0300
committerGravatar Vitaly Takmazov2017-01-12 20:41:16 +0300
commitffc944ae8cf95dd90b752444a6ce16b011bcd81e (patch)
treeeaecf89bff89d20ff03e56293aa051ef48284945 /juick-api/src/main/java/com/juick/api/configuration
parent49aed3106645dba29d2e6802a706a288d937f1d6 (diff)
nv-websocket -> spring-websocket
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();
+ }
}