I have a codeigniter app I want to implement push notifications for. I use mysql as backend database, but I use redis as the session store so I can use it with node (just preference). When a user connects to node they pass there session id via the query parameter on
io.connect('http://123.45.67.89:3434', { query: "sessId="+sessionId })
and on the server I get it like this:
io.set('authorization', function(handshakeData, accept) {
// get user details from redis using the session id sent here
console.log('User Session Id: ', handshakeData._query.sessId);
accept(null, true);
});
I am able to get the users data out of redis to save a list of connected users.
I want to save a list of connected users in an array with their profile_id and the socket.id
client_list[user.profile_id] = socket.id;
so i can search for users via id and get their socket connection id and send that user a notification for what ever reason.
My problem is I can send the sessionId in the authorization event but can't get the socket.id, and I can get the socket.id in the connection event but can't pass data along on that event.
How can I send a session id and get the socket.id on connection to the socket.io server?
Thanks in advanced :)