aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/api/TelegramBotHook.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/juick/api/TelegramBotHook.java b/src/main/java/com/juick/api/TelegramBotHook.java
index 83eea3140..2d64b83e2 100644
--- a/src/main/java/com/juick/api/TelegramBotHook.java
+++ b/src/main/java/com/juick/api/TelegramBotHook.java
@@ -37,8 +37,16 @@ public class TelegramBotHook {
bot.setWebhook("https://api.juick.com/tlgmbtwbhk");
try {
ws = new WebSocketFactory().createSocket("wss://ws.juick.com/_all");
+ ws.addHeader("Origin", "ws.juick.com");
+ ws.addHeader("Host", "ws.juick.com"); //TODO: remove from server
+ ws.setPingInterval(60 * 1000);
ws.addListener(new WebSocketAdapter() {
@Override
+ public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception {
+ logger.info("ws disconnected");
+ }
+
+ @Override
public void onConnected(WebSocket websocket, Map<String, List<String>> headers) {
logger.info("ws connected");
}