mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
[Glitch] Better manage subscriptionCounters
Port 9669557be1
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
parent
3bbf6b1519
commit
72b1d5fdc5
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
KNOWN_EVENT_TYPES.forEach(type => {
|
||||
|
Loading…
Reference in New Issue
Block a user