Disconnect from socket faster on loss of network access (#1512)
* Disconnect from socket faster on complete loss of network access Today we wait for a keepalive request to fail; this change forces disconnect in the case that the browser tells us that we're now offline. FREEBIE * MessageReceiver: don't react to errors after explicit close() FREEBIE
This commit is contained in:
parent
b0f9644c14
commit
6323f598b5
3 changed files with 41 additions and 8 deletions
|
@ -38394,6 +38394,7 @@ MessageReceiver.prototype.extend({
|
|||
this.incoming = [this.pending];
|
||||
},
|
||||
close: function() {
|
||||
this.calledClose = true;
|
||||
this.socket.close(3000, 'called close');
|
||||
return this.drain();
|
||||
},
|
||||
|
@ -38407,7 +38408,17 @@ MessageReceiver.prototype.extend({
|
|||
return Promise.all(this.dispatchEvent(event));
|
||||
},
|
||||
onclose: function(ev) {
|
||||
console.log('websocket closed', ev.code, ev.reason || '');
|
||||
console.log(
|
||||
'websocket closed',
|
||||
ev.code,
|
||||
ev.reason || '',
|
||||
'calledClose:',
|
||||
this.calledClose
|
||||
);
|
||||
|
||||
if (this.calledClose) {
|
||||
return;
|
||||
}
|
||||
if (ev.code === 3000) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue