Ignore unexpected WebSocket disconnection errors silently

master
Sven Slootweg 7 years ago
parent 06ef0fa19a
commit bed9fefc9c

@ -28,7 +28,11 @@ module.exports = function createClientStore(options = {}) {
let data = JSON.stringify(message); let data = JSON.stringify(message);
this.socket.send(data, (error) => { this.socket.send(data, (error) => {
if (error != null) { if (error != null) {
store.emit("error", error); if (error.message === "not opened") {
/* The socket has disappeared. We can safely ignore this. Is there a more reliable way to detect this error than by its message, though? */
} else {
store.emit("error", error);
}
} }
}); });
} }

Loading…
Cancel
Save