handle empty message (ping) in ws

This commit is contained in:
Morgan Bazalgette 2018-03-31 14:54:56 +02:00 committed by Haelwenn (lanodan) Monnier
parent 3445b80b9e
commit 6c39e8c9d3
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -74,7 +74,10 @@ export default function getStream(streamingAPIBaseURL, accessToken, stream, { co
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`);
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;