I am trying to implement pg NOTIFY , LISTEN and I saw this example.
var pg = require ('pg'),
pgConnectionString = "postgres://user:pass@localhost/db";
var client = new pg.Client(pgConnectionString);
client.connect();
client.query('LISTEN "article_watcher"');
client.on('notification', function(data) { console.log(data.payload);});
Is this possible using this package?
I tried doing
const pg = new PgAsync(uri)
// create schema, trigger functions code
pg.connect((client) => {
client.on('notification', (msg) => {
console.log(JSON.parse(msg.payload))
})
})
But it's just giving out errors.
I am trying to implement pg
NOTIFY,LISTENand I saw this example.Is this possible using this package?
I tried doing
But it's just giving out errors.