Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
rpc & pubsub
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
README.md
onnex.js
package.json

README.md

Onnex

rpc & subpub

Installation

$ npm install onnex

Example

onnex A

be server

var onnex = require("onnex");

var onnexA = onnex.create();

onnexA.addFunction("multi",function( a , b ){
    var cb = Array.prototype.slice.call(arguments).pop();
    cb(null,  a * b );
});

onnexA.publish("time tick");

setInterval(function(){
    onnexA.publish("time tick", new Date().getTime() );
} , 1000 );

onnexA.addBind({ port: 8080 });

onnex B

be client

var onnex = require("onnex");

var onnexB = onnex.create();

onnexB.addConnect({ port: 8080 , alwaysConnect: true});

onnexB.subscribe("time tick",function( time ){
        console.log("time :" , new Date(time));
});

onnexB.callFunction("multi", 2 , 3  , function( err , result ){
        console.log("2 * 3 :" , result);
});
Something went wrong with that request. Please try again.