|
|
@ -112,11 +112,10 @@ const sharedCallbacks = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
disconnected () { |
|
|
|
disconnected () { |
|
|
|
subscriptions.forEach(({ onDisconnect }) => onDisconnect()); |
|
|
|
subscriptions.forEach(subscription => unsubscribe(subscription)); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
reconnected () { |
|
|
|
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('&')}`); |
|
|
|
const es = new EventSource(`${streamingAPIBaseURL}/api/v1/streaming/${channelName}?${params.join('&')}`); |
|
|
|
|
|
|
|
|
|
|
|
let firstConnect = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
es.onopen = () => { |
|
|
|
es.onopen = () => { |
|
|
|
if (firstConnect) { |
|
|
|
connected(); |
|
|
|
firstConnect = false; |
|
|
|
|
|
|
|
connected(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
reconnected(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
KNOWN_EVENT_TYPES.forEach(type => { |
|
|
|
KNOWN_EVENT_TYPES.forEach(type => { |
|
|
|