This is a node js module for socket.io applications. This module finds and manages which socket is from who and visa versa. One user per person. User means: Unlimited (new) browser tabs/windows but same machine. OR client can pass custom authorized id and have one user with it's sockets per group of different machines. Make use of the middleware.
$ npm install socket.io.users
Live Example (Greek language)
Go to http://chat.ideopod.com
var express = ;var app = ;var server = ;var socketUsers = ;socketUsers;//IMPORTANTvar rootIo = server; //default '/' as namespace.var chatIo = rootIo;var rootUsers = socketUsersUsers; /* default '/' as namespace. Each namespace has IT's OWN users object list,but the Id of a user of any other namespace may has the same value if request comes from the same client-machine-user.This makes easy to keep a kind of synchronization between all users of all different namespaces. */var chatUsers = socketUsersUsers; //rootIo;//IMPORTANT but no errors if you want to skip it for a io.of(namespace) that you don't want the socket.io.users' support.chatUsers;chatUsers;rootUsers;rootUsers;rootUsers;//You can still use the io.on events, but the execution is after connected and connection of the 'users' and 'chatUsers', no matter the order.rootIo;