aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-12 23:32:50 +0300
committerGravatar Vitaly Takmazov2016-05-12 23:32:50 +0300
commitd77b21dcf62c3e8d63615d5ef5acaaaf2614736d (patch)
treed3132ecbba13837196c33d5a392a78410beb3585 /src/main/java
parent2c7fb63528ee2544d2c9f6f32047c9178618331b (diff)
add ping
Diffstat (limited to 'src/main/java')
-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 83eea314..2d64b83e 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");
}