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?
Asked
Active
Viewed 4,697 times
2
-
How do they disconnect? Is it a build in timeout in the socket? Does it somehow crash after 90 seconds? – Emil S. Jørgensen Feb 26 '19 at 09:19
-
Possible duplicate: https://stackoverflow.com/questions/4852702/do-html-websockets-maintain-an-open-connection-for-each-client-does-this-scale – Mebin Joe Feb 26 '19 at 09:19
-
In my Node script I see 1006 code when disconnected. – krzyhub Feb 26 '19 at 09:29
-
Backend is written in which language? – sarath Feb 26 '19 at 12:39
-
@sarath Symphony 2.8.6 gos:websocket:server – krzyhub Feb 26 '19 at 13:11
1 Answers
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