Closed Garam-Leee closed 9 months ago
Use 7.0.0 @stomp/stompjs and 1.6.1 sockjs-client
In case of normal connection
>>> CONNECT
accept-version:1.2,1.1,1.0
heart-beat:2000,2000
<<< CONNECTED
heart-beat:0,0
version:1.2
content-length:0
>>> SUBSCRIBE
id:sub-0
destination:/sub/noti/1
In case of server reboot, only console.log
>>> CONNECT
accept-version:1.2,1.1,1.0
heart-beat:2000,2000
You are likely hit by SockJS and/or your broker limitations. Please see https://stomp-js.github.io/guide/stompjs/rx-stomp/using-stomp-with-sockjs.html
Please notice that the CONNECTED
frame has heart-beat:0,0
. That indicates that your setup has disabled heartbeats. Heartbeats are one of the mechanisms to detect a stale connection.
My initial suggestion will be to rewrite the code without using SockJS.
After the server restarts and the socket connection is disconnected, how does it know when it is reconnected?
I knew that onConnect works for reconnect, but it doesn't seem to work that way.