Allow clients to fetch statuses made while they were offline (#6876)
This commit is contained in:
parent
59657e24b9
commit
9a1a55ce52
22 changed files with 191 additions and 259 deletions
|
@ -1,10 +1,10 @@
|
|||
import WebSocketClient from 'websocket.js';
|
||||
|
||||
export function connectStream(path, pollingRefresh = null, callbacks = () => ({ onConnect() {}, onDisconnect() {}, onReceive() {} })) {
|
||||
export function connectStream(path, pollingRefresh = null, callbacks = () => ({ onDisconnect() {}, onReceive() {} })) {
|
||||
return (dispatch, getState) => {
|
||||
const streamingAPIBaseURL = getState().getIn(['meta', 'streaming_api_base_url']);
|
||||
const accessToken = getState().getIn(['meta', 'access_token']);
|
||||
const { onConnect, onDisconnect, onReceive } = callbacks(dispatch, getState);
|
||||
const { onDisconnect, onReceive } = callbacks(dispatch, getState);
|
||||
let polling = null;
|
||||
|
||||
const setupPolling = () => {
|
||||
|
@ -25,7 +25,6 @@ export function connectStream(path, pollingRefresh = null, callbacks = () => ({
|
|||
if (pollingRefresh) {
|
||||
clearPolling();
|
||||
}
|
||||
onConnect();
|
||||
},
|
||||
|
||||
disconnected () {
|
||||
|
@ -44,7 +43,6 @@ export function connectStream(path, pollingRefresh = null, callbacks = () => ({
|
|||
clearPolling();
|
||||
pollingRefresh(dispatch);
|
||||
}
|
||||
onConnect();
|
||||
},
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue