From 72162affcf2b7386694ef11c41008f95210b77c1 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 10 Feb 2021 23:08:00 -0500 Subject: [PATCH] Updated stream ws to close if backend api error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - stream ws to close if backend api error and not retry over and over again --- app/javascript/gabsocial/stream.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/javascript/gabsocial/stream.js b/app/javascript/gabsocial/stream.js index 123390e9..46998340 100644 --- a/app/javascript/gabsocial/stream.js +++ b/app/javascript/gabsocial/stream.js @@ -76,6 +76,10 @@ export default function getStream(streamingAPIBaseURL, accessToken, stream, { co const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`, accessToken); ws.onopen = connected; + ws.onerror = (e) => { + // If errors, dont retry + ws.close(); + }; ws.onmessage = e => received(JSON.parse(e.data)); ws.onclose = disconnected; ws.onreconnect = reconnected;