2

I have two clients connected through WebSocket server that is behind my influence field. After about 1,5 minutes both clientes get disconnected. Reconnecting is not the best solution in my case, because it takes time and sometimes it occures that there should be send a message withing this time. Is this a kind of a server side configuration to maintain communication instantly? Is there a way to keep connection established doing something on the client side?

krzyhub
  • 6,285
  • 11
  • 42
  • 68

1 Answers1

6

The Websocket protocol implements so called PING/PONG messages to keep Websockets alive, even behind proxies, firewalls and load-balancers. The server sends a PING message to the client through the Websocket, which then replies with PONG. If the client does not reply, the server closes the connection.

Check Your server config probably a wrong config have this side effect.

Gianluca Musa
  • 755
  • 7
  • 22
  • Thank you. I will check that and mark your answer as a solution after some time if this would be it. – krzyhub Feb 26 '19 at 09:36
  • I recieved response from server service that there was something missing in config file, a host record poiting to my api IP or something... – krzyhub Feb 27 '19 at 10:19
  • Does ```Nginx``` send a ```PING message``` to the client? or does our app server like ```tomcat``` send a ``` PING message``` to the client? – Hossein Safari Aug 17 '21 at 06:44
  • Normally the webserver like ngnix or other (not to old) support the websoket protocol, this feature need to be enabled and have a correct config. – Gianluca Musa Aug 18 '21 at 09:42