mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
split between initial connection timer and reconnection timers
This commit is contained in:
@@ -50,6 +50,7 @@ export default class ConnectorSwUpdates extends Connector{
|
||||
url: "https://raw.githubusercontent.com/nttgin/BGPalerter/main/package.json"
|
||||
})
|
||||
.then(data => {
|
||||
|
||||
if (data && data.data && data.data.version && semver.gt(data.data.version, this.version)) {
|
||||
this._message({
|
||||
type: "software-update",
|
||||
|
||||
@@ -9,8 +9,9 @@ export default class WebSocket {
|
||||
this.options = options;
|
||||
this.ws = null;
|
||||
this.alive = false;
|
||||
this.pingInterval = options.pingInterval || 40000;
|
||||
this.reconnectSeconds = options.reconnectSeconds || 30000;
|
||||
this.pingInterval = options.pingIntervalSeconds ? options.pingIntervalSeconds * 1000 : 40000;
|
||||
this.reconnectSeconds = options.reconnectSeconds ? options.reconnectSeconds * 1000 : 30000;
|
||||
this.connectionDelay = 5000;
|
||||
this.lastPingReceived = null;
|
||||
}
|
||||
|
||||
@@ -85,7 +86,9 @@ export default class WebSocket {
|
||||
if (this.connectTimeout) {
|
||||
clearTimeout(this.connectTimeout);
|
||||
}
|
||||
this.connectTimeout = setTimeout(this._connect, this.reconnectSeconds);
|
||||
this.connectTimeout = setTimeout(this._connect, this.connectionDelay);
|
||||
|
||||
this.connectionDelay = this.reconnectSeconds;
|
||||
};
|
||||
|
||||
disconnect = () => {
|
||||
|
||||
Reference in New Issue
Block a user