A JavaScript message bus library creating powerful features

npm install mesh --save
Mesh is a library that gives you the utilities needed to build a sophisticated messaging layer that facilitates remote, and local communication for your application. Server-side and client-side.
Just a utility

Think of it like underscore for data. Mesh is just a bundle of helpful functions that make it easy to write explicit and flexible data handlers. Use it with any framework on any platform - Mesh should be complimentary to your existing application stack.


import LocalStorageDsBus from 'mesh-local-storage-ds-bus';
import SocketIoBus from 'mesh-socket-io-bus';
import { ParallelBus } from 'mesh';

// var storage = FakeStorageBus.create();
var storageBus = LocalStorageDsBus.create();

// persist all operations to socket.io & any operations from socket.io
// back to local storage.
var mainBus = ParallelBus.create([
  storageBus,
  SocketIoBus.create({ channel: "operations" }, storageBus)
]);

// insert data. Persists to local storage, and gets
// broadcasted to all connected clients.
mainBus.execute({
  action : "insert",
  collection : "messages"
  data : { text: "hello world" }
}).readAll().then(function() {
  // handle response
});
    

Flexible

Mesh is unopinionated. Use it to bring sanity to even the most complicated APIs.

Adaptable

Write highly testable apps that work with any database, any API. No more vendor lock-in.

Modular

Write complex features with ease. Connect services together such as socket.io, and local storage to build things such as realtime data, rollbacks, offline mode, and more.