A streamable interface for Pubnub. This library also works nicely with mesh, and other mesh adapters.
Example
var pubnub = ;var memory = ;var mesh = ; var mem = mesh; var pubnub = mesh
db pubnub(options, responseBus)
Creates a new pubnub streamer.
options
subscribeKey
- your pubnub subscription keypublishKey
- your pubnub publish keychannel
- (optional) the channel to subscribe to
responseBus
- set of commands to reject - default is[load]
var pubStream = ; // does not get broadcasted;
db.addChannel(channel)
adds a new channel to subscribe to.
pubStream;pubStream
stream.Readable db(operationName, options)
Publishes a new operation to pubnub.
;;
stream.Readable db(tail, filter)
Tails a remote operation. This is your subscription function.
db({ name: "tail" }).on("data", function(operation) {
});
Or you can do something like synchronizing databases between clients:
var mesh = ;var loki = ;var pubnub = ; var pubdb = ; var db = mesh; // listen for local operations on lokidb - pass to pubnub; // listen for remote operations on pubnub - pass to lokidb; // stored in loki & synchronized across clients;