Anshul Sharma
Anshul Sharma

Reputation: 43

Spring websocket connection closes on network disconnect

I am using spring WebSocket on server side and angular client using ng-websocket. So I am using this WebSocket for sending a ping from the client and server respond with pong. This all works fine unless I disconnect my network. So the problem I am facing right now is, particularly on a windows machine. So when network disconnects websocket do not reconnect and the connection gets closed. But when I do the same in Linux machine it reconnects and works fine but on windows, after 10 seconds it disconnects and I got web socket closed on the client side. So I need to know is there any configuration required for WebSocket timeout on windows.
Thanks in advance.

Upvotes: 0

Views: 1130

Answers (1)

Palla
Palla

Reputation: 1262

Check below link, you should write logic to check periodically and connect.

https://github.com/websockets/ws/wiki/Websocket-client-implementation-for-auto-reconnect

Hope this should help you

Upvotes: 0

Related Questions