0.0.1 • Published 8 years ago

congo-proxy v0.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

Congo Proxy

Congo Proxy enables you to easily create proxies use that use Congo.

The proxy uses the invoker to execute a remote call that will be received by the listener on the other end, then responses are retured by the responder. For more info see: Congo Core Explained

Insallation

npm install congo-proxy --save

Usage

Setup the proxy:

var congoProxy = require('congo-proxy');

var proxy = congoProxy("myService", invoker);
proxy.registerMethod("someMethod");
proxy.registerObservable("someObservable");
var myService = proxy.build();

The invoker object should be and object that implements:

invoke(remoteCall: RemoteCall): Observable<Object>

and is responsible for transporting the remote call over the communication layer. see congo-examples for more info.

Once the proxy is created use it as you would use any Promise (for methods) or Observable (for observables)

myService.someMethod()
    .then(result => console.log(result));

myService.someObservable()
    .doOnNext(result => console.log(result))
    .subscribe();
0.0.1

8 years ago