最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - WebSocket - how to keep connection? - Stack Overflow

programmeradmin4浏览0评论

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 munication instantly? Is there a way to keep connection established doing something on the client side?

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 munication instantly? Is there a way to keep connection established doing something on the client side?

Share Improve this question asked Feb 26, 2019 at 9:15 krzyhubkrzyhub 6,55011 gold badges44 silver badges70 bronze badges 5
  • How do they disconnect? Is it a build in timeout in the socket? Does it somehow crash after 90 seconds? – Emil S. Jørgensen Commented Feb 26, 2019 at 9:19
  • Possible duplicate: stackoverflow./questions/4852702/… – Mebin Joe Commented Feb 26, 2019 at 9:19
  • In my Node script I see 1006 code when disconnected. – krzyhub Commented Feb 26, 2019 at 9:29
  • Backend is written in which language? – sarath Commented Feb 26, 2019 at 12:39
  • @sarath Symphony 2.8.6 gos:websocket:server – krzyhub Commented Feb 26, 2019 at 13:11
Add a ment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论