Billyzou0741326 / bilibili-live-monitor-js

弃用 b站限制单ip连接数
MIT License
20 stars 5 forks source link

[New Feature] 隔一段时间发送一个心跳包,防止一些客户端认为服务器掉线 #96

Closed ghost closed 4 years ago

ghost commented 4 years ago

可否加一个这样的功能呢大佬(其实是我技术不行没写重连的),然后aiohttp就超时了

Billyzou0741326 commented 4 years ago

用的是ws,服务器会对客户端发个ping 然后客户端反馈pong 服务器的设定是20秒ping一次,如果20秒内没收到客户端的pong就关闭连接

20秒ping一次 https://github.com/Billyzou0741326/bilibili-live-monitor-js/blob/fa873d4aa67d7c9259bba9c87560c9e2665cfc1b/src/server/wshost.js#L89-L96

收到pong就标为alive https://github.com/Billyzou0741326/bilibili-live-monitor-js/blob/fa873d4aa67d7c9259bba9c87560c9e2665cfc1b/src/server/wshost.js#L63-L65

所以client端设定一下自动对服务端的ping返回一个pong就好了

ghost commented 4 years ago

好的,谢谢大佬了。

Billyzou0741326 commented 4 years ago

不用不用hhh 需要的话可以详细说下需求(推测是自写了客户端?) 我看下有时间研究研究aiohttp怎么适配

ghost commented 4 years ago

不用不用hhh 需要的话可以详细说下需求(推测是自写了客户端?) 我看下有时间研究研究aiohttp怎么适配

大佬可以点进去看下我那个hhh,搞的有点像广告

Billyzou0741326 commented 4 years ago

没什么广告不广告的23333

ghost commented 4 years ago

那就行hhh