From 5a53061b48d9a3a0d2e0c509f6393d3c3a7d1607 Mon Sep 17 00:00:00 2001 From: Andy Zhang <37402126+AnzhiZhang@users.noreply.github.com> Date: Wed, 21 Dec 2022 20:45:13 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20automatically=20reconnect?= =?UTF-8?q?=20kook=20websocket=20when=20disconnected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zhanganzhi/chathub/receiver/KookReceiver.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/zhanganzhi/chathub/receiver/KookReceiver.java b/src/main/java/com/zhanganzhi/chathub/receiver/KookReceiver.java index dade8c3..424de11 100644 --- a/src/main/java/com/zhanganzhi/chathub/receiver/KookReceiver.java +++ b/src/main/java/com/zhanganzhi/chathub/receiver/KookReceiver.java @@ -132,4 +132,10 @@ public void onMessage(@NotNull WebSocket webSocket, @NotNull String text) { e.printStackTrace(); } } + + @Override + public void onFailure(@NotNull WebSocket webSocket, @NotNull Throwable t, Response response) { + logger.error("Kook websocket session disconnected! Reconnecting..."); + restart(); + } }