show close code and reason on ws close
This commit is contained in:
parent
0964133dbe
commit
5b33219f13
1 changed files with 5 additions and 5 deletions
|
@ -77,8 +77,9 @@ export default class App extends Component {
|
||||||
this.subscribeToChannels();
|
this.subscribeToChannels();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.websocket.onclose = () => {
|
this.websocket.onclose = ({ code, reason }) => {
|
||||||
log(`ws closed; attempting to reconnect in ${this.reconnectionTime}ms`);
|
log(`ws closed with code ${code} (reason: ${reason || '<none>'}); `
|
||||||
|
+ `attempting to reconnect in ${this.reconnectionTime}ms`);
|
||||||
setTimeout(() => this.connect(), this.reconnectionTime);
|
setTimeout(() => this.connect(), this.reconnectionTime);
|
||||||
this.reconnectionTime *= 2;
|
this.reconnectionTime *= 2;
|
||||||
};
|
};
|
||||||
|
@ -91,12 +92,11 @@ export default class App extends Component {
|
||||||
this.handlePacket(parsed);
|
this.handlePacket(parsed);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.websocket.onerror = (error) => {
|
this.websocket.onerror = (event) => {
|
||||||
log('ws error:', error);
|
log('ws error:', event);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_send(payload) {
|
_send(payload) {
|
||||||
this.websocket.send(JSON.stringify(payload));
|
this.websocket.send(JSON.stringify(payload));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue