Upon login, get the client to send a login action through your websocket.

If you're not too worried about security, on the client, do something like:

   sessionid = fetchMySessionID(); // you need to provide this function of 
course;..
   socket.emit('sessionid', sessionid);

Otherwise you'd need to send a crypto hash of the password for instance to 
make sure nobody's spoofing your sessionid.


Then on the server side, keep track of your connections in a dictionary:

    var connections = {};
    io.sockets.on('connection', function(socket) {
        socket.on('sessionid', function(sessionid) {
            console.log(sessionid, 'connected');
            connections[username] = socket;
        });
    });


You can send send messages to a given session id:

        connections[someSessionID].emit ('dummyEvent', { foo: 'bar', baz: 
'buz' });


Is that what you're looking for?

Cheers
JM

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to