websockets messages are NOT receiving after some time | ReactJS and springboot application
Please help me with any workaround for this problem.
It appears that the web sockets are not being received after a certain period of time. I have established a websocket connection using STOMPJS in a ReactJS application alongside a Spring Boot backend.
For reference, I have followed the setup instructions provided in the following link: https://spring.io/guides/gs/messaging-stomp-websocket.
I would greatly appreciate any assistance or workarounds you can offer to resolve this problem. Thank you!
@kum-deepak Please help on this.
I do not use Spring or React Native, so I am unable to provide specific guidance. The STOMP supports Heartbeats, both client-initiated and broker-initiated. These help the connection remain alive even during inactivity.
Please see https://stomp-js.github.io/guide/stompjs/using-stompjs-v5.html#heart-beating to enable it on the client side. Please check the Spring documentation on how to add support on the server side.
Once you implement the heartbeating, the client will disconnect and reconnect if the connection goes stale (i.e., it is no longer valid).
@kum-deepak Thanks for your answer! Heartbeats are by default enabled both the side front and backside. I am not sure this issues happens due to heartbeat. Also I observed - If I opened multiples tabs with same session, then sometimes client won't receive messages in either tab or both tab. I noticed this issue frequently.
Is there am I missing anything on my end? I have setup heartbeat also both on frontend and backend side but still messages are not guaranteed to receive ALL TIME.
Please throw some light on this.
i got same issues. Any solution