WampSharp icon indicating copy to clipboard operation
WampSharp copied to clipboard

Alternative transport support

Open BrannonKing opened this issue 8 years ago • 3 comments

I was considering writing a NetMQ (ZeroMQ) transport for WampSharp. However, in looking at the existing transports, it was not obvious how this could be accomplished. I figured I would just need to override a certain interface, but it looks like I need to inherit TextBinaryTransport<>, and I have no idea what is supposed to go in that generic parameter (or why its name is an oxymoron). Do we have any documentation on how to accomplish this?

BrannonKing avatar Oct 21 '15 17:10 BrannonKing

We don't really have documentation about this. Do you plan to support multiple serialization types? WebSocket and RawSocket transports support both binary and text serialization based on handshake negotiation.

darkl avatar Oct 21 '15 17:10 darkl

I suppose I should support both binary and text. The NetMQ message get/put support both.

BrannonKing avatar Oct 21 '15 17:10 BrannonKing

So the way to go is to inherit TextBinaryTransport. The generic parameter is the underlying real connection (i.e. the session object that NetMQ provides you). It is there so you get it in all relevant methods (the method that determines what subprotocol you are using, and the methods that create the text/binary WAMP connections). For implementing the IWampConnection interface, the base AsyncWampConnection class is provided. In this class the TMessage should remain a generic parameter which will be determined by the given user WampBinding.

darkl avatar Oct 21 '15 17:10 darkl