node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

Build Status Coverage Status Dependency Status

Streams for Also works with mesh.

Basic example

var mesh = require("mesh");
var loki = require("mesh-loki");
var io   = require("");
var bus = mesh.tailable(loki());
// setup socket io - take all remote ops and pass 
// to the bus 
var iobus = mesh.reject("load", io({
  host: "http://localhost"
}, bus));
// pipe all operations on bus to 
// insert data into the DB. Should get broadcasted 
// to 
bus(mesh.op("insert", {
  collection: "people"
  data: {
    name: "Shrek"

server configuration

Server configuration is pretty easy to setup. Just re-broadcast incomming operations.

var io = require("");
var server = io(80);
server.on("connection", function(connection) {
  // note that "operation" is the channel that the client is 
  // publishing / subscribing to 
  connection.on("operation", function(operation) {
    // re-broadcast to other clients 
    connection.broadcast.emit("operation", operation);

db(options, bus)

creates a new streamer.

  • options
    • host - server host
    • channel - channel to subscribe to. Default is operation.
  • bus - bus to pass remote calls to
var iodb = io({
  host: "http://localhost",
  channel: "myOperationsChannel"

stream.Readable db(operationName, options)

Broadcasts a new operation. This can be anything.

stream.Readable db(tail, filter)

Tails a remote operation.

// tail all operations 
db(mesh.op("tail")).on("data", function() {
// tail only insert operations 
db(mesh.op("tail", { name: "insert" })).on("data", function() {
// tail only operations on people collection 
db(mesh.op("tail", { collection: "people" })).on("data", function() {