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.websocket.onclose = () => {
|
||||
log(`ws closed; attempting to reconnect in ${this.reconnectionTime}ms`);
|
||||
this.websocket.onclose = ({ code, reason }) => {
|
||||
log(`ws closed with code ${code} (reason: ${reason || '<none>'}); `
|
||||
+ `attempting to reconnect in ${this.reconnectionTime}ms`);
|
||||
setTimeout(() => this.connect(), this.reconnectionTime);
|
||||
this.reconnectionTime *= 2;
|
||||
};
|
||||
|
@ -91,12 +92,11 @@ export default class App extends Component {
|
|||
this.handlePacket(parsed);
|
||||
};
|
||||
|
||||
this.websocket.onerror = (error) => {
|
||||
log('ws error:', error);
|
||||
this.websocket.onerror = (event) => {
|
||||
log('ws error:', event);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
_send(payload) {
|
||||
this.websocket.send(JSON.stringify(payload));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue