Wamp with WampSharp and Autobahn

346 views
Skip to first unread message

Sam

unread,
Jul 9, 2015, 2:14:38 PM7/9/15
to wam...@googlegroups.com
Hi all,

I'm new to WebSockets and even more to WAMP, but I thinks it's what I need for my project.

Simplifying, my project is one (for now) Android device communicating with a C# application. I need
the RPC functionnality and the publish/subscribe too.
There wasn't that many options available for c# and Android (WampSharp and Autobahn).

I'm just starting to explore these two solutions. There's a few things that I would like to see with
you guys that have more experience on the subject.

So first of all, great work on WampSharp, it's looking good, but there are some weird examples
on the github wiki page (maybe I find them weird due too lack of experience ?)

https://github.com/Code-Sharp/WampSharp/wiki/Getting-Started-with-Callee


The callee example - one off the first one I tried. Both client and router register callee:
Task<IAsyncDisposable> registrationTask = realm.Services.RegisterCallee(instance);

Anyway after looking at the code a bit and trying I managed to get an RPC method executed on the router
from the client.

There is another thing, I see there's a difference between the reflection based method and the raw method.
Does this mean that you can only use reflection on the C# end when your clients and router are C# ? Or can
you for example from the Autobahn Android client call C# RPC methods that use reflection ?

Also for my project I would like to be able to get the list of Android devices connected to the C# application,
would this be possible ? Like ask the router for the connected clients ?

Thanks for you time.

Elad Zelingher

unread,
Jul 9, 2015, 3:09:55 PM7/9/15
to wam...@googlegroups.com
Hi Sam,

Glad you like WampSharp.

Regarding your questions:

1) I guess you are asking about the api you quoted. Well, the method returns a Task that is complete (or faulted) after a REGISTERED (or an ERROR)  response is received from router. The result of the Task is a IAsyncDisposable, which is a type that has a method called DisposeAsync and returns a Task. This object allows you to unregister the registered callee from the router by calling DisposeAsync. DisposeAsync is complete (or faulted) when an UNREGISTERED (or an ERROR)  response is received from Router.
The api is async also for Router side, in order to make api identical, so you can easily modify your code so it runs outside the router. (in general WAMP encourages routers not to run application code)
2) The reflection based api works with general peers (callees/callers/routers), and not only with WampSharp based peers. The reason raw api exists is because WAMP is very generic and allows a lot kinds of messages (including positional arguments and keyword arguments). The reflection based api is my interpretation for how most usage should look like, but its a subset of the protocol various options. For example, in reflection based callee, methods should usually return a single argument. If you want to have more control of your returned keyword arguments/positional arguments, you probably should use the raw api.
3) You can register to a realm's SessionCreated/SessionClosed events in order to track what clients are currently connected. This will be addressed in a future release with a better solution, WAMP meta-api.

Please note that AutobahnAndroid doesn't support WAMPv2, you can use jawampa instead.

Please ask further WampSharp questions in the GitHub project page.

Elad

Sam

unread,
Jul 10, 2015, 9:57:39 AM7/10/15
to wam...@googlegroups.com
Thanks for the answer.

I'll try and understand the examples with your explanations when I get the time to do so :)
jawampa looks good too. I'll also post further questions, if I have any, on the GitHub project.

Thanks again for your insight.
Sam
Reply all
Reply to author
Forward
0 new messages