Notification on a local network with Postgresql

Asked

Viewed 90 times

2

I would like to know how to send a simple notification to users of a local network, send a notification to all other devices with the app connected to the Postgresql database...

  • I recommend you create an application for this, which connects to the bank and sends the notification via WCF

1 answer

2


No Postgresql(Versao >= 9.1) you can make use of the pair LISTEN/NOTIFY to do something like this.

These functions enable bank-connected clients to receive asynchronous notifications through a specific channel.

For example, clients connected to the database that are listening to the channel foobar, will be able to receive notifications:

LISTEN foobar;

To notify customers listening on the channel foobar:

NOTIFY foobar, 'Oi, eu sou uma notificacao!';

If you want a particular customer to stop listening to the notification channel foobar:

UNLISTEN foobar;

Reference:

https://www.postgresql.org/docs/current/static/sql-notify.html

I hope I’ve helped!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.