@@ -34,6 +34,8 @@ static Persistent<String> routine_symbol;
34
34
static Persistent<String> name_symbol;
35
35
static Persistent<String> value_symbol;
36
36
static Persistent<String> type_symbol;
37
+ static Persistent<String> channel_symbol;
38
+ static Persistent<String> payload_symbol;
37
39
38
40
class Connection : public EventEmitter {
39
41
@@ -70,6 +72,8 @@ class Connection : public EventEmitter {
70
72
name_symbol = NODE_PSYMBOL (" name" );
71
73
value_symbol = NODE_PSYMBOL (" value" );
72
74
type_symbol = NODE_PSYMBOL (" type" );
75
+ channel_symbol = NODE_PSYMBOL (" channel" );
76
+ payload_symbol = NODE_PSYMBOL (" payload" );
73
77
74
78
75
79
NODE_SET_PROTOTYPE_METHOD (t, " connect" , Connect);
@@ -390,7 +394,8 @@ class Connection : public EventEmitter {
390
394
PGnotify *notify;
391
395
while ((notify = PQnotifies (connection_))) {
392
396
Local<Object> result = Object::New ();
393
- result->Set (String::New (" channel" ), String::New (notify->relname ));
397
+ result->Set (channel_symbol, String::New (notify->relname ));
398
+ result->Set (payload_symbol, String::New (notify->extra ));
394
399
Handle <Value> res = (Handle <Value>)result;
395
400
Emit ((Handle <String>)String::New (" notification" ), 1 , &res);
396
401
PQfreemem (notify);
0 commit comments