Created
          June 22, 2011 04:37 
        
      - 
      
- 
        Save dvv/1039507 to your computer and use it in GitHub Desktop. 
    socket.io-honor-http-data-in-connection-event
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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