[glitch-port] handle empty message (ping) in ws

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-09-14 02:47:59 +02:00
parent 16f477c8e2
commit 04d6e60bd3
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;