Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix #403 #404

Closed
wants to merge 1 commit into from

1 participant

@zzzaaa

Check active connection when WS emit onclose. If currently active other connection (not WS), pass self.onclose()

@zzzaaa zzzaaa fix #403
 Check active connection when emited WS onclose.  If currently active other connection (not WS), pass self.onclose()
8e04ffe
@zzzaaa zzzaaa closed this
@zzzaaa zzzaaa reopened this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2012
  1. @zzzaaa

    fix #403

    zzzaaa authored
     Check active connection when emited WS onclose.  If currently active other connection (not WS), pass self.onclose()
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/transports/websocket.js
View
14 lib/transports/websocket.js
@@ -73,8 +73,18 @@
self.onData(ev.data);
};
this.websocket.onclose = function () {
- self.onClose();
- self.socket.setBuffer(true);
+ var isWebsocketClose = false;
+ for (var socketKey in window.io.sockets){
+ var socket = window.io.sockets[socketKey];
+ if (socket.transport.name == self.name){
+ isWebsocketClose = true;
+ break;
+ }
+ }
+ if (isWebsocketClose){
+ self.onClose();
+ self.socket.setBuffer(true);
+ }
};
this.websocket.onerror = function (e) {
self.onError(e);
Something went wrong with that request. Please try again.