You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have the reconnect algorithm do exponential backoff to prevent clients from flooding the server.
如果重新连接算法能够进行指数退避,从而防止客户端淹没服务器,那就太好了。
Example 例子
constEXPONENT_BASE=1.15;// 指数基数reconnect(): void{// 已重连次数小于等于设置的连接次数时执行重连 | Reconnect when the number of reconnections is less than or equal to the set connection timesif(this.reconnectionCount<=this.reconnectionAttempts){this.reconnectionCount++;letreconnectionDelay;if(this.reconnectionExponentialBackoff){constmultiplier=(EXPONENT_BASE**(this.reconnectionCount-1));reconnectionDelay=this.reconnectionDelay*multiplier;}else{reconnectionDelay=this.reconnectionDelay;}
My example, 1.15, is just a suggestion but it would lead to:
我的示例 1.15 只是一个建议,但它会导致:
reconnectionCount
multiplier
1
1
2
1.15
3
1.3225
4
1.520875
5
1.74900625
6
2.01135719
7
2.31306077
8
2.66001988
9
3.05902286
10
3.51787629
11
4.04555774
12
4.6523914
13
5.35025011
14
6.15278762
15
7.07570576
The text was updated successfully, but these errors were encountered:
It would be nice to have the reconnect algorithm do exponential backoff to prevent clients from flooding the server.
如果重新连接算法能够进行指数退避,从而防止客户端淹没服务器,那就太好了。
Example 例子
My example, 1.15, is just a suggestion but it would lead to:
我的示例 1.15 只是一个建议,但它会导致:
The text was updated successfully, but these errors were encountered: