7

I am using stomp js in my angular project and also using WebSocket in java spring for backend.

Here is the scenario where if internet connection is lost in the client pc then how to notify the client that they are disconnected from the WebSocket connection and how to automatically reconnect with a client when it gets internet connection again?

I am using @stomp/ng2-stompjs "^7.2.0". Thanks in advance

lambodar
  • 3,495
  • 5
  • 34
  • 58
Hardik Siroya
  • 117
  • 2
  • 9
  • Formatting for batter readability. – lambodar Nov 22 '19 at 14:54
  • Possibly related - https://stackoverflow.com/questions/50170970/spring-boot-websocket-with-stomp-js-i-keep-getting-whoops-lost-connection-to-h . – Freiheit Nov 22 '19 at 14:57
  • Also related - https://stackoverflow.com/questions/24513818/how-to-tell-when-a-stomp-server-disconnected-from-the-stomp-js-client – Freiheit Nov 22 '19 at 14:59
  • It looks like Stomp throws an error `Whoops! Lost connection to...` and provides a few places to intercept or change that error handling. You need to find out where to implement that error handling. When a problem happens you can then create a notice visible to your user about a missing connection. – Freiheit Nov 22 '19 at 15:00
  • I had connected with stomp now after connected successfully there is no internet connection on my pc for some time or you can say I had lost my internet connection for some time now when I get the internet connection back at that time what i need to do to handle this case? @Freiheit – Hardik Siroya Nov 27 '19 at 04:38
  • yes exatly same use case i want@Freiheit – Hardik Siroya Dec 08 '20 at 06:19

0 Answers0