Skip to content

Instantly share code, notes, and snippets.

@dvv
Created June 22, 2011 04:37
Show Gist options
  • Save dvv/1039507 to your computer and use it in GitHub Desktop.
Save dvv/1039507 to your computer and use it in GitHub Desktop.
socket.io-honor-http-data-in-connection-event
diff --git a/lib/manager.js b/lib/manager.js
index 24ac437..e2565e0 100644
--- a/lib/manager.js
+++ b/lib/manager.js
@@ -343,7 +343,7 @@ Manager.prototype.handleClient = function (data, req) {
// echo back connect packet and fire connection event
if (i === '') {
- self.namespaces[i].handlePacket(data.id, { type: 'connect' });
+ self.namespaces[i].handlePacket(data.id, { type: 'connect', data: data });
}
}
diff --git a/lib/namespace.js b/lib/namespace.js
index 8b99a89..ae79143 100644
--- a/lib/namespace.js
+++ b/lib/namespace.js
@@ -217,7 +217,7 @@ SocketNamespace.prototype.handlePacket = function (sessid, packet) {
this.store.join(sessid, this.name, function () {
// packet echo
socket.packet({ type: 'connect' });
- self.emit('connection', socket);
+ self.emit('connection', socket, packet.data);
});
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment