Nexus Uplink Client (Isomorphic)
Nexus Uplink is an dead-simple, lightweight protocol on top of which Flux over the Wire can be implemented.
On the client side, a Nexus Uplink Client can react to stores updates, and dispatch actions. On the server side, a Nexus Uplink Server can react to actions dispatchs, and update stores.
Briefly:
- actions are transported via POST requests (url pathname is the action identifier, JSON-encoded body is the payload)
- updates are transported via Websocket (or Engine.IO fallback) (as diff objects)
This package is an isomorphic (which means it can run on either Node.js or in the browser via browserify/webpack) implementation of the Nexus Uplink client-side protocol. Also see the simple server implementation of the Nexus Uplink server-side protocol.
Example
On the server:
var server = pid: _ // stores, rooms and actions are url patterns whitelists stores: '/ping' rooms: actions: '/ping' // pass an express or express-like app app: ; var pingCounter = 0; // setup action handlersserveractions;
On the client:
var client = url: 'http://localhost' ; // subscribe to remote updatesclient; // fire-and-forget dispatch actions;
Installation
npm install nexus-uplink-simple-server --save