diff options
author | Vitaly Takmazov | 2016-05-12 23:32:50 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-05-12 23:32:50 +0300 |
commit | d77b21dcf62c3e8d63615d5ef5acaaaf2614736d (patch) | |
tree | d3132ecbba13837196c33d5a392a78410beb3585 /src/main/java/com/juick | |
parent | 2c7fb63528ee2544d2c9f6f32047c9178618331b (diff) |
add ping
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/api/TelegramBotHook.java | 8 |
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"); } |