WebSocket: Keep-alive
16th August 2022 at 9:47am
WebSocket
主流 IM 的实现:
微信网页版:HTTP blocking polling
京东网页客服:WebSocket,JSON,30s 一次心跳
淘宝天猫:没有网页客服
Telegram 网页版:WebSocket,二进制协议,没有心跳,每条 WS 请求维持 30s 左右就断掉重连
Slack:WebSocket,JSON,10s 一次心跳
Discord:WebSocket,上行 JSON 下行二进制协议,40s 一次心跳
参考文档:
https://www.rfc-editor.org/rfc/rfc6455#section-5.5.2
https://websockets.readthedocs.io/en/latest/topics/timeouts.html
https://www.w3.org/Bugs/Public/show_bug.cgi?id=13104
https://blog.stephencleary.com/2009/05/detection-of-half-open-dropped.html