0.1.11 • Published 11 years ago

onnex v0.1.11

Weekly downloads
46
License
-
Repository
github
Last release
11 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

11 years ago

0.1.10

11 years ago

0.1.9

11 years ago

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago