commit: ea89621dd45800b2f03caad32ec3afd0d517056a
parent: b7ebaab8a86751fc4b58a6138a6d28ceaae76ec5
Author: Morgan Bazalgette <the@howl.moe>
Date: Sat, 31 Mar 2018 14:54:56 +0200
handle empty message (ping) in ws
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/javascript/mastodon/stream.js b/app/javascript/mastodon/stream.js
@@ -69,7 +69,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;