Unbeknownst to many people, the excellent open-source database PostgreSQL can pass around messages on channels to asynchronous listeners. It is a very simple and useful service if you want to push messages and already use Postgres. You can read more about it here and see some demos here along with some slides from a talk.
LISTEN virtual;
NOTIFY virtual;
Asynchronous notification "virtual" received from server process with PID 8448.
NOTIFY virtual, 'This is the payload';
Asynchronous notification "virtual" with payload "This is the payload" received from server process with PID 8448.
WSNotify is a websocket server. Clients can connect and request to listen on a channel, and can also post events. It essentially is a push notification system using PostgreSQL as the transport. This makes it easy to push messages from other applications directly to any connected clients, in publish-subscribe style.
Copy config.yaml to /etc/wsnotify/config.yaml and edit it to select a port to listen on and your database connection info.
To send and receive asynchronous messages through Postgres you can use any Postgres client library, as basically all of them support this capability. You can also use libpq and select()
for C applications demo here.
....
...