mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +00:00
Updated Client (markdown)
parent
be64882280
commit
eb6e9273aa
@ -311,12 +311,15 @@ Used for "LISTEN/NOTIFY" interactions. You can do some fun pub-sub style stuff
|
||||
client1.on('notification', function(msg) {
|
||||
console.log(msg.channel); //outputs 'boom'
|
||||
});
|
||||
client1.query("LISTEN boom", function() {
|
||||
client1.query("LISTEN boom");
|
||||
//need to let the first query actually complete
|
||||
//client1 will remain listening to channel 'boom' until it's 'end' is called
|
||||
setTimeout(function() {
|
||||
client2.query("NOTIFY boom", function() {
|
||||
client1.end();
|
||||
client2.end();
|
||||
});
|
||||
});
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user