I wrote a code for broadcasting a message to all users:
// websocket and http servers
var webSocketServer = require(\'websocket\').server;
...
...
v
interesting post (similar to what I am doing). We are making an API (in C#) to connect dispensers with WebSockets, for each dispenser we create a ConcurrentDictionary that stores the WebSocket and the DispenserId making it easy for each Dispenser to create a WebSocket and use it afterwards without thread problems (invoking specific functions on the WebSocket like GetSettings or RequestTicket). The difference for you example is the use of ConcurrentDictionary instead of an array to isolate each element (never attempted to do such in javascript). Best regards,