working on bubbling up notifications

This commit is contained in:
brianc 2011-03-03 22:55:06 -06:00
parent 13a5803aac
commit 16aa5ae981
2 changed files with 16 additions and 0 deletions

View File

@ -242,6 +242,8 @@ protected:
assert(PQisnonblocking(connection_));
PQsetNoticeReceiver(connection_, NoticeReceiver, NULL);
TRACE("Setting watchers to socket");
ev_io_set(&read_watcher_, fd, EV_READ);
ev_io_set(&write_watcher_, fd, EV_WRITE);
@ -253,6 +255,11 @@ protected:
return true;
}
static void NoticeReceiver(void *arg, const PGresult *res)
{
printf("*****NOTICE*********%s","\n");
}
void HandleNotice(void *arg, const PGresult *res)
{
}

View File

@ -0,0 +1,9 @@
var helper = require(__dirname + "/test-helper");
test('passes connection notification', function() {
var client = new Client();
assert.emits(client, 'notify', function(msg) {
assert.equal(msg, "HAY!!");
})
client.connection.emit('notify', "HAY!!");
})