title: How can a postgres 9.4 server know if a client is listening on a notify channel?
body: <p>I have a situation where I want to send out notification to users if they have been added to a particular table in my postgreSQL DB. </p>
  
  <p>I am using pg_notify to send out a json payload to a NODE.js server that has implemented a pg client to listen on the notification channel. This works well. </p>
  
  <p>What I can't decide is how best to inform the postgres server that someone is listening and the notify was received and is being processed. I would ideally like to use the same channel for the client to notify the server. However, as I understand it, the postgres server will only act as a hub for the channel, simply receiving the notification from the client and pushing it back to all other subscribed listeners. </p>
  
  <p>Is this actually the case? Can I build a function on the postgres server that is triggered by incoming notifications on the channel? </p>
  
  <p>The only other solution that occurs to me is to have a column in the table to record that a notification has been received an get the Node.js server to update the table on receipt of the notification, but this requires an additional connection that I would like to avoid. </p>
  
  <p>Any thoughts or experience with this would be greatly appreciated. </p>