Publish changes. Subscribe on changes. How to think?

I have read many articles and watched many tutorial videos, but the common ground for most of the material is to Publish changes to ALL users. Not Subscribing and get information what concerns just the user who is logged in.

The other common ground is Websockets protocol. There seems to be many other ways to skin this cat (Mark Twain) and I have some doubt which one to chose.

What I am searching for is a way for the user to login and connect to a server (Websocket server?) and say something like
“Hey, I am Joe, please keep me updated on MY stuff”.

I have managed to set up a websocket server, but I only gets more confused how to proceed. How to think? The closest I have found is this. But this is above my pay grade. I do understand nothing.

In this stage I am mostly interested in “how to think”? No language specific.

Any input or direction is welcome!

The thing with websockets is that’s they’re very nice and powerful, but they’re also really low-level. If you want to build something with them I would recommend getting a framework that’s built on top of websockets and then build in this. A popular example is SocketIO. They have implemented what you’re looking for by a concept they call “Rooms”, i.e. when you connect to the server you’re always connected to the “Default room” where all notifications go, but you can also join a room that is just for you, or just for a group of people. See for documentation.

Thank you for this. It seems to be simple to join a room, but how do I get “Joes stuff” to his room? ´Send a query to Postgresql? Once or every 5 minutes?

Connect to SocketIO from whatever server side language you’re using, join Joe’s room, send a message :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.