0.1.11 • Published 9 years ago

onnex v0.1.11

Weekly downloads
46
License
-
Repository
github
Last release
9 years ago

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);
});
0.1.11

9 years ago

0.1.10

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

11 years ago

0.1.0

11 years ago