working on bubbling up notifications
This commit is contained in:
parent
13a5803aac
commit
16aa5ae981
@ -242,6 +242,8 @@ protected:
|
|||||||
|
|
||||||
assert(PQisnonblocking(connection_));
|
assert(PQisnonblocking(connection_));
|
||||||
|
|
||||||
|
PQsetNoticeReceiver(connection_, NoticeReceiver, NULL);
|
||||||
|
|
||||||
TRACE("Setting watchers to socket");
|
TRACE("Setting watchers to socket");
|
||||||
ev_io_set(&read_watcher_, fd, EV_READ);
|
ev_io_set(&read_watcher_, fd, EV_READ);
|
||||||
ev_io_set(&write_watcher_, fd, EV_WRITE);
|
ev_io_set(&write_watcher_, fd, EV_WRITE);
|
||||||
@ -253,6 +255,11 @@ protected:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void NoticeReceiver(void *arg, const PGresult *res)
|
||||||
|
{
|
||||||
|
printf("*****NOTICE*********%s","\n");
|
||||||
|
}
|
||||||
|
|
||||||
void HandleNotice(void *arg, const PGresult *res)
|
void HandleNotice(void *arg, const PGresult *res)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
9
test/unit/client/notification-tests.js
Normal file
9
test/unit/client/notification-tests.js
Normal 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!!");
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user