From 59671a751bf671571bc967b96626b9a0a1a3fff8 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Fri, 30 Dec 2022 23:19:19 +0100 Subject: [PATCH] remove reconnect function --- index.js | 2 +- public/scripts/network.js | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 8ecc2e2..1ec8079 100644 --- a/index.js +++ b/index.js @@ -52,7 +52,7 @@ const http = require('http'); const limiter = RateLimit({ windowMs: 5 * 60 * 1000, // 5 minutes - max: 100, // Limit each IP to 100 requests per `window` (here, per 5 minutes) + max: 1000, // Limit each IP to 100 requests per `window` (here, per 5 minutes) message: 'Too many requests from this IP Address, please try again after 5 minutes.', standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers legacyHeaders: false, // Disable the `X-RateLimit-*` headers diff --git a/public/scripts/network.js b/public/scripts/network.js index b3183a3..6557bf9 100644 --- a/public/scripts/network.js +++ b/public/scripts/network.js @@ -8,7 +8,7 @@ class ServerConnection { Events.on('beforeunload', e => this._disconnect()); Events.on('pagehide', e => this._disconnect()); document.addEventListener('visibilitychange', e => this._onVisibilityChange()); - Events.on('online', this._reconnect); + Events.on('online', this._connect); } _connect() { @@ -21,7 +21,7 @@ class ServerConnection { ws.onclose = _ => this._onDisconnect(); ws.onerror = e => this._onError(e); this._socket = ws; - Events.on('reconnect', this._reconnect); + Events.on('reconnect', this._connect); } _onMessage(msg) { @@ -91,12 +91,6 @@ class ServerConnection { return this._socket && this._socket.readyState === this._socket.CONNECTING; } - _reconnect() { - console.log("reconnect") - this._disconnect(); - this._connect(); - } - _onError(e) { console.error(e); this._connect();