PostgreSQL Notify/Listen Tips

Hey all, I’m working on a database application and am starting to look into the PostgresqlDatabase Notify and Listen function. I’m having trouble wrapping my head around how exactly to use it. I am looking to have multiple users connected to the database and have the database push changes to the clients whenever there is a change. Here is what I have figured out so far. I need to create a trigger in postgres that sends a notification to clients whenever a change is made to a table.( I am still trying to figure out the specifics of how to make that happen, but I am fairly confident I can figure that part out.) On the client side I am a little more confused on what the best method is. It is sounding like I need to create some sort of timer that continually checks for a new notification and reacts accordingly if it does. But it seems like there should be a better way.
This is my first time working with Postgres and could really use any suggestions you can give me.


Have you looked at the ListenNotify examples that come with Xojo?


These examples run on the client, not the server. But they allow any client to listen for notifications sent from any other client. There may be a way for the server to also send a notification, but I’m not familiar with that.

Be aware that Xojo does not have support for the payload parameter of Notify/Listen.
That means that you can only send a notification to all clients that listens to the same channel but you can’t pass any variable data to the listeners.

A rule could be created that would send a notification when a table is updated.