Wednesday, 4 October 2017

How would I implement a pub-sub pattern in node where there can be several publishers in one room updating each other?

I created a version of it with socket.io with rooms but I've received a new requirement that the system should be able to handle several publishers. The publishers and subscribers are two different mobile apps.So I would have to save the publishers of the room in the API or be forced to broadcast all data to everyone in the room and have the clients not listen to the events. The latter seems terrible to me.The thing about adding publishers to a caching layer is that (as far as I know) I can't know if sockets disconnect involuntarily (after a crash etc.). It also seems wrong to do it this way (unsalable).How could I do it?Also, I just discovered this subreddit. You guys are into node! It's so cool.

Submitted October 05, 2017 at 01:47AM by brogramming102

No comments:

Post a Comment