I am making a simple chat, so when someone logs on I have this:
socket.broadcast.emit('logon', { socketID: socket.id, username: username }); So if I login via chrome as "Bob", and then I log in via Edge as "Ted", I will see "Ted" when "Ted" logs in and I am looking at the chat with chrome.
But how do I get the list of current clients with usernames as soon as I log in?
So if "Ted" is already there, and I log in as "Bob" from a different browser, I want to see "Ted" in the list.
Is it possible to do without using a database to store each user that logs in, as that is the only way I can think of but would prefer not to use a database?