lolplayer101 lolplayer101 -3 years ago 65
Node.js Question

are socket io rooms automaticaly destroyed if empty?

Im starting out with node.js and

I have 2 questions:
- When a room is empty, is it automatically destoyed unbtil recreated?
and if it is not destroyed automaticaly, does it take up much ressources on the server?

  • on the server side. is it the io server or the connected socket that should transmit the data?


Answer Source

The room is automatically removed from the array and the nodeJSs' V8 Garbage Collector finished the job of completely removing the room from ram. You don't have to worry about any of that. Remember that all users are automatically put on a room on joining the server ( the named room ). io.emit should be used when you want to send a message from the server to anyone and socket.emit should be used when you want to send a message only to the sender. More information can be found on this answer:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download