DDP Server based on Events
The implementation of DDP server based on EventEmitter.
Usage
$ npm install --save ddp-server-event
var server = http;var ddp = server: server; ddp; ddp; ddp; // all methods calls are prefixed with "method:"ddp; server;
Methods
Each event handler binded to ddp
instance as this
, such methods are available.
ddp.sendResult(id, result);
Sends the result back to subscriber.
ddp.sendError(id, error);
Sends the error back to subscriber.
ddp.sendAdded(id, collection, fields);
Sends added back to subscriber.
ddp.sendChanged(id, collection, fields, cleared);
Sends changed back to subscriber.
ddp.sendRemoved(id, collection, fields, cleared);
Sends removed back to subscriber.
ddp.sendReady(id);
Sends ready event, should be called inside sub
event handler.
ddp.sendNosub(id);
Sends nosub event, should be called inside sub
event handler.
ddp.sendEvent(msg, data);
Sends generic back to subscriber.
References
Usage
- alexbeletsky/sparkling - Reactive API for Express.js