sockjs / sockjs-client

WebSocket emulation - Javascript client
MIT License
8.43k stars 1.3k forks source link

Why webstomp client over sockJs gets disconnected automatically #458

Closed Roopam-91 closed 5 years ago

Roopam-91 commented 5 years ago

I use webstomp client over SockJs for streaming certain information from server.

I use spring boot at server side with below configuration.

sockJS: streamBytesLimt: 4194304 serverHeartbeatMs: 5000 clientHeartbeatMs: 5000 stomp: sendBufferSizeLimit:10485760 messageSizeLimit:5242880 sendTimeOut: 30000

It works usually but if we keep the browser open for a long time, client gets disconnected and doesn't get reconnected until being refreshed.

I noticed below sequence of events when the issue appears

1)For some reason request(xhr) doesn't go from webstomp client (checked in Network tab of chrome) 2)Unless stomp client is connected, we dont send heartbeat. 3) when server realizes session is ideal for more than (60s), websocket closes the session 4) Then Error block of webstomp client 's connection request gets executed. 5) Then I try reconnecting after disconnecting gracefully, And 1,2,3,4 continues until page is being refreshed

uvarajnk commented 5 years ago

I am also facing same issue. Is there any solution please suggest

Mitgenosse commented 5 years ago

Did anyone find something out regarding this?

uvarajnk commented 5 years ago

Did anyone find something out regarding this?

This happened when the sticky session is not enabled when we have multiple instances running. After setting sticky session the issue resolved in my case.