subs.js: fix a reconnection bug
Subscriptions would mistakenly report being closed due to a reversed pair of connection state constants in the ws/sse switch, in isOpen(). This caused sockets to consider themselves open when they were, in fact, closed.
This commit is contained in:
parent
a99da9bbdc
commit
1ceb9b5f4b
1 changed files with 3 additions and 2 deletions
|
@ -78,9 +78,9 @@ var subs = (function() {
|
|||
|
||||
isOpen: function() {
|
||||
if (server_type == "ws") {
|
||||
return this.ws && (this.ws.readyState != EventSource.CLOSED)
|
||||
} else {
|
||||
return this.ws && (this.ws.readyState != WebSocket.CLOSED)
|
||||
} else {
|
||||
return this.ws && (this.ws.readyState != EventSource.CLOSED)
|
||||
}
|
||||
},
|
||||
isClosed: function() { return !this.isOpen() },
|
||||
|
@ -99,6 +99,7 @@ var subs = (function() {
|
|||
|
||||
open: function() {
|
||||
if (this.isOpen()) return this;
|
||||
|
||||
console.log("will open url: " + this.url());
|
||||
|
||||
var ws;
|
||||
|
|
Loading…
Reference in a new issue