|
|
@ -71,11 +71,7 @@ export function connectStream(path, pollingRefresh = null, callbacks = () => ({ |
|
|
|
export default function getStream(streamingAPIBaseURL, accessToken, stream, { connected, received, disconnected, reconnected }) { |
|
|
|
export default function getStream(streamingAPIBaseURL, accessToken, stream, { connected, received, disconnected, reconnected }) { |
|
|
|
const params = [ `stream=${stream}` ]; |
|
|
|
const params = [ `stream=${stream}` ]; |
|
|
|
|
|
|
|
|
|
|
|
if (accessToken !== null) { |
|
|
|
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`, accessToken); |
|
|
|
params.push(`access_token=${accessToken}`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ws.onopen = connected; |
|
|
|
ws.onopen = connected; |
|
|
|
ws.onmessage = e => received(JSON.parse(e.data)); |
|
|
|
ws.onmessage = e => received(JSON.parse(e.data)); |
|
|
|