handle empty message (ping) in ws
This commit is contained in:
parent
3b52fd966d
commit
ba1eb17d90
2 changed files with 8 additions and 2 deletions
|
@ -85,7 +85,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;
|
||||
|
||||
|
|
|
@ -85,7 +85,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