Skip to content

Commit 612e28a

Browse files
authored
[Bug-4149] Bug fix for web socket session do not closed correctly and page stuck caused by it (#4161)
1 parent bd04590 commit 612e28a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dinky-admin/src/main/java/org/dinky/ws/GlobalWebSocket.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public enum EventType {
9494
private static final Map<Session, RequestDTO> TOPICS = new ConcurrentHashMap<>();
9595

9696
@OnOpen
97-
public void onOpen(Session session) {}
97+
public void onOpen(Session session) {
98+
session.setMaxIdleTimeout(30000);
99+
}
98100

99101
@OnClose
100102
public void onClose(Session session) {

dinky-web/src/models/UseWebSocketModel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default () => {
5959
const ws = useRef<WebSocket>();
6060

6161
const reconnect = () => {
62-
if (ws.current && ws.current.readyState === WebSocket.CLOSED) {
62+
if (ws.current && ws.current.readyState === WebSocket.OPEN) {
6363
ws.current.close();
6464
}
6565
ws.current = new WebSocket(wsUrl);

0 commit comments

Comments
 (0)