handle empty message (ping) in ws
This commit is contained in:
parent
a6cfa80508
commit
8fc1a6114f
2 changed files with 8 additions and 2 deletions
|
@ -74,7 +74,10 @@ export default function getStream(streamingAPIBaseURL, accessToken, stream, { co
|
|||
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`, accessToken);
|
||||
|
||||
ws.onopen = connected;
|
||||
ws.onmessage = e => received(JSON.parse(e.data));
|
||||
ws.onmessage = e => {
|
||||
if (e.data !== '')
|
||||
received(JSON.parse(e.data));
|
||||
};
|
||||
ws.onclose = disconnected;
|
||||
ws.onreconnect = reconnected;
|
||||
|
||||
|
|
|
@ -74,7 +74,10 @@ export default function getStream(streamingAPIBaseURL, accessToken, stream, { co
|
|||
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`, accessToken);
|
||||
|
||||
ws.onopen = connected;
|
||||
ws.onmessage = e => received(JSON.parse(e.data));
|
||||
ws.onmessage = e => {
|
||||
if (e.data !== '')
|
||||
received(JSON.parse(e.data));
|
||||
};
|
||||
ws.onclose = disconnected;
|
||||
ws.onreconnect = reconnected;
|
||||
|
||||
|
|
Loading…
Reference in a new issue