From c8edcae8bb4c7def9fb47eb21adc0f6614d67713 Mon Sep 17 00:00:00 2001 From: paulpdaniels Date: Tue, 14 Oct 2014 13:55:36 -0700 Subject: [PATCH] Update README.md --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index edeeac0..3e1d6a5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ rx.wamp ======= -A wrapper library for the autobahn wamp v2 library in the browser/node +A wrapper library for the autobahn wamp v1/v2 library in the browser/node ### Connection @@ -113,7 +113,7 @@ session.callObservable("wamp.my.add", [2, 3], {}, {}) console.log("Result was %s", value.args[0]); }); -//TODO Shorthand +//Shorthand var add = session.caller("wamp.my.add"); add([2, 3]).subscribe(function(value) { @@ -122,6 +122,47 @@ add([2, 3]).subscribe(function(value) { }); ``` +## V1 + +It also supports the v1 library. + + +### Subscribing + +```javascript + +//Notice the difference between this and v2 +session.subscribeObservable("wamp.subscribe.event") + .subscribe(function(event) { + console.log("New event: %s", event); + }); + +``` + +### Publishing + +```javascript + +session.publishObservable("wamp.publish.event", {id : "me"}, true) + .subscribeOnCompleted(function(){}); + +``` + +### Calling methods + +```javascript + +session.callObservable("wamp.my.add", 2, 3) + .subscribe(function(value){ + console.log("Result was %d", value); + }); + + + +``` + + + ###TODO