Skip to content

Commit

Permalink
#48
Browse files Browse the repository at this point in the history
  • Loading branch information
takayama-lily committed Sep 7, 2021
1 parent 8ce1d30 commit 370d9d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
ws_reverse_url: [ //反向ws地址,可以添加多个url
// "ws://your.address.com:8080",
],
ws_reverse_reconnect_interval: 3000, //反向ws断线重连间隔(毫秒),设为0直接不重连
ws_reverse_reconnect_interval: 3000, //反向ws断线重连间隔(毫秒),设为负数直接不重连
ws_reverse_reconnect_on_code_1000: true, //反向ws是否在关闭状态码为1000的时候重连
},

Expand Down
2 changes: 1 addition & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function createWSClient(url, headers) {
});
ws.on("close", (code)=>{
websockets.delete(ws);
if ((code === 1000 && config.ws_reverse_reconnect_on_code_1000 === false) || config.ws_reverse_reconnect_interval > 0 === false)
if ((code === 1000 && config.ws_reverse_reconnect_on_code_1000 === false) || config.ws_reverse_reconnect_interval >= 0 === false)
return bot.logger.info(`反向ws连接(${url})被关闭,关闭码${code}。不再重连。`);
bot.logger.error(`反向ws连接(${url})被关闭,关闭码${code},将在${config.ws_reverse_reconnect_interval}毫秒后尝试连接。`);
setTimeout(()=>{
Expand Down

0 comments on commit 370d9d5

Please sign in to comment.