I have a Node.js Express RESTful HTTP server I will call server A and an Express socket.io server I will call server B.
Server A responds to all HTTP requests by clients and server B listens to the MongoDB oplog and sends database updates currently to all clients.
I don't want to send all DB updates to all the clients -I want to optimize the system so that server B and the connected clients experience less load by partitioning server B so that only certain/relevant DB updates are sent to certain clients...In this way server B could send just a fraction of the messages it would have before, and each client wouldn't have to handle all the updates.
I have read a little bit about socket.io rooms and how clients can join a namespace.
In the past I have appended the user id to all MongoDB collections that pertain to a certain user, so I could have each client join the namespace denoted by their user id.
This might mean that each client only gets the updates corresponding to their namespace on the server + a few universal updates that pertain to all users.
My question is how to best design this so that all users get the updates they need while minimizing the load on the server and the clients.
Does anyone have any advice on how to best do this with MongoDB, the MongoDB oplog and a separate socket.io server?