WebSockets in Chrome and Firefox Disconnecting After One Minute of Inactivity

前端 未结 4 1807
陌清茗
陌清茗 2021-02-07 04:08

I have found that WebSockets in Chrome and Firefox disconnect after exactly one minute of inactivity. Based on stuff I\'ve seen online, I was all set to blame proxies or some s

4条回答
  •  没有蜡笔的小新
    2021-02-07 04:11

    The WebSocket protocol specification defines Ping and Pong frames that can be used for keep-alive, heart-beats, network status probing. Ping means client/server is sending an iq to tell the other side server/client that to keep the connection alive and also the other side will send an acknowledgement with pong having same payload data.

    You can also define a timeout when the browser stops respond or be considered dead.

    read more: http://vunse.blogspot.in/2014/04/websocket-ping-pong.html

提交回复
热议问题