WampSharp

871 views
Skip to first unread message

Elad Zelingher

unread,
Jul 23, 2013, 5:29:11 AM7/23/13
to wam...@googlegroups.com
Hi, I've been working in the couple last months on a .NET implementation (written in C#) of WAMP.

It is called WampSharp, you can find it here.

I've implemented both server and client sides.

Note that it is still not stable, and there could be some bugs, but the tutorials work :)

I'd be happy for feedback on this, issues and pull requests via GitHub will be appreciated.

Enjoy,
Elad

Tobias Oberstein

unread,
Jul 23, 2013, 11:18:40 AM7/23/13
to wam...@googlegroups.com, Elad Zelingher
Hi Elad,

Am 23.07.2013 11:29, schrieb Elad Zelingher:
> Hi, I've been working in the couple last months on a .NET implementation
> (written in C#) of WAMP.
>
> It is called WampSharp, you can find it here
> <https://github.com/darkl/WampSharp>.

Very nice! I've added it to

http://www.wamp.ws/implementations

Curious: which WebSocket and which JSON libs are you using?

>
> I've implemented both server and client sides.

Having a C#/.NET WAMP client implementation is great! This should open
the road to native Windows Phone apps using WAMP or Excel Addins
(imagine receiving PubSub events for real-time update of cells etc).
Very exciting. I wish I had more time;(

>
> Note that it is still not stable, and there could be some bugs, but the
> tutorials work :)

Great! Note that we started work on extending AutobahnTestsuite for WAMP
.. we expect to release something in september. This should allow us to
bring interoperability between WAMP implementations to a solid ground ..

Thanks alot for joining the WAMP community and for sharing your work!

/Tobias

>
> I'd be happy for feedback on this, issues and pull requests via GitHub
> will be appreciated.
>
> Enjoy,
> Elad
>
> --
> You received this message because you are subscribed to the Google
> Groups "WAMP" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wampws+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Elad Zelingher

unread,
Jul 23, 2013, 3:00:29 PM7/23/13
to wam...@googlegroups.com, Elad Zelingher
On Tuesday, July 23, 2013 6:18:40 PM UTC+3, Tobias Oberstein wrote:
Curious: which WebSocket and which JSON libs are you using? 

I use Newtonsoft.Json for serialization, Fleck for WebSocket listener, WebSocket4Net for WebSocket client.
However, these are pluggable, hence other implementations can be provided (WampSharp.dll doesn't know about these libraries, only WampSharp.Default.dll does)   
Great! Note that we started work on extending AutobahnTestsuite for WAMP 
.. we expect to release something in september. This should allow us to
bring interoperability between WAMP implementations to a solid ground ..

I actually used AutobahnTestsuite for testing my WAMP client against a AutobahnPython server, and also used the html client pages of AutobahnTestsuite in order to create some unit tests for the framework. 
I wish there was some official demo to implement, some simple task (such as a chat or a calculator) with a given api, which I can implement above my framework in order to test whether my framework can deal with it (There should be an official client with the task that can test the demo)


Thanks alot for joining the WAMP community and for sharing your work!

Thanks! I'm looking forward for WAMP v2, I think WAMP has lots of potential, but should be spread more widely (there is no article on WAMP in wikipedia for instance)

Tobias Oberstein

unread,
Jul 24, 2013, 7:29:46 AM7/24/13
to wam...@googlegroups.com, Elad Zelingher
Am 23.07.2013 21:00, schrieb Elad Zelingher:
> On Tuesday, July 23, 2013 6:18:40 PM UTC+3, Tobias Oberstein wrote:
>
> Curious: which WebSocket and which JSON libs are you using?
>
>
> I use Newtonsoft.Json for serialization, Fleck for WebSocket listener,
> WebSocket4Net for WebSocket client.

Awesome: for the client-side, these are the libs we contemplated to base

https://github.com/tavendo/AutobahnDotNet

upon. Now there is WampSharp (and hence a WAMP client), we probably
won't waste time writing AutobahnDotNet (not that we started on the
latter anyway;) ..

I've been reading the client tutorial: wondering how you handle RPC errors?

E.g. here is how AutobahnAndroid looks like when calling an endpoint:

https://github.com/tavendo/AutobahnAndroid/blob/master/Demo/SimpleRpc/src/de/tavendo/autobahn/simplerpc/SimpleRpcActivity.java#L129

Can I use instances of custom classes a payload for RPC args/results or
PubSub events?

E.g. have a look at the 2nd example at

http://www.autobahn.ws/android

"""
Call results and events which travel the wire as JSON payload are
automatically converted and mapped to Java primitive types or
user-defined POJOs (Plain-old Java Objects).

The latter is a very convenient and powerful feature made possible by
the use of Jackson, a high-performance JSON processor. This works even
for container types, such as lists or maps over POJOs.

For example, it is possible to issue a RPC and get a List<Person> as a
result, where Person is a user-defined class.
"""
http://www.autobahn.ws/android/reference

This auto-mapping of JSON to/from custom classes is nice .. and I once
tried to find out if JSON.NET would allow similar stuff as Jackson:

http://json.codeplex.com/discussions/361250

No answer;(

> However, these are pluggable, hence other implementations can be
> provided (WampSharp.dll doesn't know about these libraries, only
> WampSharp.Default.dll does)
>
> Great! Note that we started work on extending AutobahnTestsuite for
> WAMP
> .. we expect to release something in september. This should allow us to
> bring interoperability between WAMP implementations to a solid
> ground ..
>
>
> I actually used AutobahnTestsuite for testing my WAMP client against a
> AutobahnPython server, and also used the html client pages of
> AutobahnTestsuite in order to create some unit tests for the framework.
> I wish there was some official demo to implement, some simple task (such
> as a chat or a calculator) with a given api, which I can implement above
> my framework in order to test whether my framework can deal with it

Yep, this is roughly how the testsuite will work - e.g. for RPC, the
wampfuzzingclient will call endpoints that are expected to be
implemented by a WAMP server that wants to be tested ..

> (There should be an official client with the task that can test the demo)
>
>
> Thanks alot for joining the WAMP community and for sharing your work!
>
>
> Thanks! I'm looking forward for WAMP v2, I think WAMP has lots of
> potential, but should be spread more widely (there is no article on WAMP
> in wikipedia for instance)

Yes, totally;)

Rgd. Wikipedia: we did not write an article ourselfes, since that would
likely be frowned upon by the Wikipedia community .. "conflict of
interest" (COI) .. so we need to wait 'till s.o. else writes it ..

I am unsure at which point a person would be regarded as not having a
COI .. probably a WAMP user.

/Tobias

Elad Zelingher

unread,
Jul 24, 2013, 9:28:08 AM7/24/13
to wam...@googlegroups.com, Elad Zelingher


On Wednesday, July 24, 2013 2:29:46 PM UTC+3, Tobias Oberstein wrote:
Am 23.07.2013 21:00, schrieb Elad Zelingher:
I've been reading the client tutorial: wondering how you handle RPC errors?

 
E.g. here is how AutobahnAndroid looks like when calling an endpoint:

https://github.com/tavendo/AutobahnAndroid/blob/master/Demo/SimpleRpc/src/de/tavendo/autobahn/simplerpc/SimpleRpcActivity.java#L129



There are two RPC client modes: The synchronous mode and the asynchronous mode.
The synchronous mode blocks until a CALLERROR or CALLRESULT is received. If a CALLERROR is received, an exception is thrown (in particular WampRpcCallException), otherwise the result of the call is returned as the proxy method result.

The asynchronous mode doesn't block. Instead it returns a Task, a .NET framework 4 type that is similar to future or promises (you can call ContinueWith with a callback, and that callback will be called when the Task completes successfully or an error occurs), and that task is complete when CALLRESULT is received and an error is set when CALLERROR is received.
 
Can I use instances of custom classes a payload for RPC args/results or
PubSub events?

E.g. have a look at the 2nd example at

http://www.autobahn.ws/android

"""
Call results and events which travel the wire as JSON payload are
automatically converted and mapped to Java primitive types or
user-defined POJOs (Plain-old Java Objects).

The latter is a very convenient and powerful feature made possible by
the use of Jackson, a high-performance JSON processor. This works even
for container types, such as lists or maps over POJOs.

For example, it is possible to issue a RPC and get a List<Person> as a
result, where Person is a user-defined class.
"""
http://www.autobahn.ws/android/reference

This auto-mapping of JSON to/from custom classes is nice .. and I once
tried to find out if JSON.NET would allow similar stuff as Jackson:

http://json.codeplex.com/discussions/361250

No answer;(


Newtonsoft.Json of course supports serialization of custom types. You can use this feature in WampSharp: 
  • In RPC calls: declare an interface with a method that receives/returns a custom type, having a [WampRpcMethod] attribute. Create a rpc proxy of the interface and call the proxy's method
  • In Pub/Sub, when calling GetSubject<T> specify the custom type you expect to send/receive. This will return a Subject of your custom type.
Note: This works for concrete types. This can also work for polymorphic types, such as interfaces and abstract/base classes, but requires a bit more work (Newtonsoft.Json supports this, but it dirties your JSON with a field containing the actual type of the serialized object, which makes your JSON very CLR specific)

Slavic

unread,
Sep 13, 2014, 4:40:44 PM9/13/14
to wam...@googlegroups.com
This is great! Thank you! 
Is this implementation compatible with .NET 2.0 or can be converted? I'm working on an app that runs inside of Unity framework which uses mono (.NET 2.0).

Elad Zelingher

unread,
Sep 15, 2014, 3:41:43 PM9/15/14
to wam...@googlegroups.com
Hi Slavic,

WampSharp isn't compatible with .NET 2.0/3.5. It won't be simple to convert it to .NET 2.0/3.5, since WampSharp relies heavily on TPL and rx and both aren't available to .NET 3.5.

It might be possible to create a port of WampSharp that is compatible .NET 3.5 thanks to the UniRx project.

Maybe you can provide more details about your application and I'll estimate how complicated is to create a version of WampSharp that satisfies your needs:

Are you interested in WAMP v1 or WAMP v2?
Are you interested in client side or server (or router) side?
In what capabilities of WampSharp are you interested?

(Just a disclaimer: I don't think I'll have time to create this version, but maybe you can work on it and make a pull request.)

Elad

בתאריך יום שבת, 13 בספטמבר 2014 23:40:44 UTC+3, מאת Slavic:

Franck Maestre

unread,
Oct 27, 2014, 9:33:48 PM10/27/14
to wam...@googlegroups.com
Hi,

Do you think parts of the Websocket-sharp   for Unity  might be useable to do the port ?


-Franck

Arnon Marcus

unread,
Feb 4, 2015, 8:59:52 AM2/4/15
to wam...@googlegroups.com
I need to use .Net 4.0, but I'm getting red-squiggles when using the example:

Is it true that async/await are a 4.5-level features?
I am actually not really interested in async for my use-case, can I use WAMPSharp in a synchronous fashion? 

Arnon Marcus

unread,
Feb 4, 2015, 9:48:41 AM2/4/15
to wam...@googlegroups.com
I tries using a different example (simple 'callee'), and now I don't have squigglies, but it crashes with an exception after a few seconds:

Reply all
Reply to author
Forward
0 new messages