diff options
author | Daigo 3 Dango <zunda@users.noreply.github.com> | 2020-08-24 12:06:45 +0000 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-08-30 16:35:33 +0200 |
commit | 72b1d5fdc547f575ce10e61b4e523dc3d9d7d036 (patch) | |
tree | ebad3912fd3cf67fd22731d0b24a16b01e4b8e15 /app/javascript | |
parent | 3bbf6b15190a361b7f826ad2b519ea2c7a202d05 (diff) |
[Glitch] Better manage subscriptionCounters
Port 9669557be1d9c8577564242861bdbad9b821906a to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/flavours/glitch/util/stream.js | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/app/javascript/flavours/glitch/util/stream.js b/app/javascript/flavours/glitch/util/stream.js index 640455b33..cf1388aed 100644 --- a/app/javascript/flavours/glitch/util/stream.js +++ b/app/javascript/flavours/glitch/util/stream.js @@ -112,11 +112,10 @@ const sharedCallbacks = { }, disconnected () { - subscriptions.forEach(({ onDisconnect }) => onDisconnect()); + subscriptions.forEach(subscription => unsubscribe(subscription)); }, reconnected () { - subscriptions.forEach(subscription => subscribe(subscription)); }, }; @@ -252,15 +251,8 @@ const createConnection = (streamingAPIBaseURL, accessToken, channelName, { conne const es = new EventSource(`${streamingAPIBaseURL}/api/v1/streaming/${channelName}?${params.join('&')}`); - let firstConnect = true; - es.onopen = () => { - if (firstConnect) { - firstConnect = false; - connected(); - } else { - reconnected(); - } + connected(); }; KNOWN_EVENT_TYPES.forEach(type => { |