How to make sockets available to classes

I’m pretty new to JS, Node and, so I’m struggling to learn best practices for a lot of things. Currently, I’m working on a website that uses both express and socket io. My sockets are stored in an object: socketList = {id: socket}. I also have a Room class. The problem is that I would like to keep my Room class in a separate js file. So, how would I give the Room class access to my sockets? The Room needs to store a few sockets, but I would prefer just passing in the id instead of the whole socket.

submitted by /u/GreatDemonSquid
[link] [comments]