You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, hyper-express is an unopinionated webserver library hence it does not track the connections internally. However, you can easily implement your own tracking like below:
importcryptofrom'crypto';// We will store connections in thisconstconnections=newMap();// Listen for ws connectionsserver.ws('/connect',(ws)=>{// Generate a random ID for this connectionconstid=crypto.randomUUID();// Track this connectionconnections.set(id,ws);// Clean up the connection once disconnectedws.once('close',()=>{// Delete the connectionconnections.delete(id);});});
how can I get all connected users via ws for later changing the data of these users?
The text was updated successfully, but these errors were encountered: