Closed
Description
I think there's a bug in socket.io 0.9.10 lib/manager.js and sending the connect packet on the second transport after the first fails. E.g. if websocket fails to connect for some reason, then xhr-polling will not have the connect packet sent from server to browser since the server only sends it on the first transport for the same session-id. The patch that seems to fix it is
@@ -666,6 +666,7 @@
return;
}
if (handshaken) {
+var t0 = this.transports[data.id];
if (transport.open) {
if (this.closed[data.id] && this.closed[data.id].length) {
transport.payload(this.closed[data.id]);
@@ -706,6 +709,21 @@
self.onClientDisconnect(data.id, reason);
});
}
+else // matches "if (!this.connected[data.id])"
+{
+var t1 = transport;
- // when transport changes, send the connect packet on the new transport
- if (t1&&t0&&t1.transport!==t0.transport)
-
for (var i in this.namespaces) {
-
if (this.namespaces.hasOwnProperty(i)) {
-
// echo back connect packet and fire connection event
-
if (i === '') {
-
this.namespaces[i].handlePacket(data.id, { type: 'connect' });
-
}
-
}
-
+}
}
} else {
if (transport.open) {
transport.error('client not handshaken', 'reconnect');
Metadata
Metadata
Assignees
Labels
No labels