Ask coding questions

← Back to all posts
How to get server-side users object in client side code
LunaTea

I am trying to make a function in my chat website that gives a list of all connected users, but the users object I have is in the server-sided code, how could I go about this?

Voters
LunaTea
Comments
hotnewtop
SixBeeps

You already have sockets set up, so just mass-blast all the clients with that users object attached every few ms or so. On the client-side, whenever the users object is received, update the list accordingly.

realTronsi

@SixBeeps lol don't do that, just send the packets on player join

LunaTea

@realTronsi I figured it out with neither of these, just decided to emit a function