C# 7.0 tuples support

Reflection-based callee tuples support

From this version, you can return a C# 7.0 tuple from a reflection-based callee method. The tuple will be serialized to either the arguments keywords or to the arguments array of the YIELD message, depending on whether the returned tuple has named elements or positional elements. (tuples having elements which are partially named are not supported)

Rx-based publish/subscribe tuples support

This version also introduces Rx-based publish/subscribe C# 7.0 tuple support. This allows to handle topics that have complex arguments in a strongly typed manner using ISubject<> api.

In order to use this feature, a mechanism called IWampEventValueTupleConverter is introduced.

This interface is responsible for converting a IWampSerializedEvent instance to a specified tuple and a specified tuple instance to a IWampEvent.

Luckily enough, in order to implement this interface it is sufficient to derive from WampEventValueTupleConverter<> and specify the desired tuple type. Nothing else is needed to be done.

(This might seem a bit odd, but that’s the best way I’m aware of for preserving ValueTuple element names after compilation)

Then, just pass an instance of your IWampEventValueTupleConverter to the new overload of IWampRealmServiceProvider’s GetSubject method, which receives the topic’s uri and an instance of IWampEventValueTupleConverter, in order to receive a ISubject<> instance of your desired tuple type.

Other features

Instance providers for reflection-based callee

From this version, new overloads for IWampRealmServiceProvider’s RegisterCallee method were added. These overloads allow you to specify an instance provider for your callee service instance, that is a Func<> delegate that returns an instance of your callee service provider.

This allows you to control yourself the lifecycle of the callee service instance. You can of course use an dependency injection framework to help you manage that.

Note: if you’re using Ninject, you’re recomended to use Ninject.Extensions.Factory which allows you to get typed factories instances or Func<> instances without being aware about the dependency injection container.

.NET Standard WebSocket4Net support

WebSocket4Net has been ported to .NET Standard 1.3 recently. From this version WampSharp.WebSocket4Net is supported for .NET Standard 1.3 as well.

This could be an alternative for running WampSharp over WebSockets on non-Windows platforms for now, until an update for .NET Core which supports WebSockets on non-Windows platforms is released.

Structured logging

From this version, some formatted logs are written using structured logging. These include properties such as session ids, incoming WAMP Json/MsgPack messages and more. This feature can be leveraged by Serilog.