Please help to choose a solution (nodeJS + socket.io + redis) for a chat room timer.
Multiple Rooms are created, every room has exactly one HOST i.e admin for that room, every room will have 500 members in it. There can be 'n' rooms at any time 't'. A room will be destroyed after 1 hour of creation.
Node server => Process room's member related data from redis and broadcast it in every room after some interval. this interval (i.e When to broadcast) is decided by an array, call it as timerArrayForRoom1. This array holds the time in seconds when to broadcast data. This array is different for every room.
Now, two approaches -
Using setInterval() in nodeJS so that it will call its broadcasting method after some time interval. Every room will have its separate interval object.
Give
timerArrayForRoom1to the HOST of the room and let the host fire an event after some seconds as per the timer array. i.e using setinterval() on client side. And node server will take its action on that event.
First approach is HOST independent but it involves use of setInterval() in NodeJS.
Which one would be better to implement so that server will be able to support 1000 rooms having 500 members in it running and broadcasting all at a time ?
Which is more reliable? (as I read setInterval() does not guarantee its time to call the function)
Or any other approach?
Host/admin will be different device and exactly one for every room, so second approach will balance the server load to some extent.