WAMP is an open standard WebSocket subprotocol that provides two application messaging patterns in one unified protocol: Remote Procedure Calls + Publish & Subscribe http://wamp-proto.org/ Because multiplayer games use RPCs calls, this seems very useful in Unity. I've found a C# project called WampSharp: https://github.com/Code-Sharp/WampSharp I've imported the DLLs into Unity 2017.3.0f3 but I'm getting an error: Code (CSharp): Exception: RemoteCertificateChainErrors Rethrow as AggregateException: One or more errors occurred. System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <c95265f74fdf4905bfb0d5a4b652216c>:0) System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) (at <c95265f74fdf4905bfb0d5a4b652216c>:0) System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout) (at <c95265f74fdf4905bfb0d5a4b652216c>:0) WAMPClientTest.Main () (at Assets/WAMPClientTest.cs:27) I've reported the error as an Issue at GitHub: https://github.com/Code-Sharp/WampSharp/issues/224 However, it's possible I've just made a mistake or there's a problem with experimental 4.6 API build in Unity? If you have any insight, please help out
I could not get the DLLs to work inside of Unity, even using .Net 4.6 build. Here's the exception: Code (CSharp): InvalidCastException: Specified cast is not valid. System.Reactive.PlatformServices.PlatformEnlightenmentProvider.CreatePlatformProvider () (at <688278ad98cb433c8f7d49b6fa93b621>:0) System.Reactive.PlatformServices.PlatformEnlightenmentProvider..cctor () (at <688278ad98cb433c8f7d49b6fa93b621>:0) Rethrow as TypeInitializationException: The type initializer for 'System.Reactive.PlatformServices.PlatformEnlightenmentProvider' threw an exception. System.Reactive.Linq.QueryServices.Initialize () (at <dae9ef48b730438fa95f19e6ce1d672c>:0) System.Reactive.Linq.QueryServices..cctor () (at <dae9ef48b730438fa95f19e6ce1d672c>:0) Rethrow as TypeInitializationException: The type initializer for 'System.Reactive.Linq.QueryServices' threw an exception. System.Reactive.Linq.Observable..cctor () (at <dae9ef48b730438fa95f19e6ce1d672c>:0) Rethrow as TypeInitializationException: The type initializer for 'System.Reactive.Linq.Observable' threw an exception. WampSharp.V2.WampClientSubject.CreateObservable (WampSharp.V2.Client.IWampTopicProxy topic, WampSharp.V2.Client.IWampClientConnectionMonitor monitor) (at C:/Users/Selzier/Desktop/WampSharp-1.2.7.45-beta/src/net45/WampSharp/WAMP2/V2/Api/Rx/WampClientSubject.cs:27) WampSharp.V2.WampClientSubject..ctor (WampSharp.V2.Client.IWampTopicProxy topic, WampSharp.V2.Client.IWampClientConnectionMonitor monitor) (at C:/Users/Selzier/Desktop/WampSharp-1.2.7.45-beta/src/net45/WampSharp/WAMP2/V2/Api/Rx/WampClientSubject.cs:22) WampSharp.V2.WampRealmProxyServiceProvider.GetSubject (System.String topicUri) (at C:/Users/Selzier/Desktop/WampSharp-1.2.7.45-beta/src/net45/WampSharp/WAMP2/V2/Api/Client/WampRealmProxyServiceProvider.cs:104) WampSharp.V2.WampRealmProxyServiceProvider.GetSubject[TEvent] (System.String topicUri) (at C:/Users/Selzier/Desktop/WampSharp-1.2.7.45-beta/src/net45/WampSharp/WAMP2/V2/Api/Client/WampRealmProxyServiceProvider.cs:93) WAMPClientTest.Main () (at Assets/WAMPClientTest.cs:40) I opened an issue on Gibhub and the developer indicated there seems to be an issue with System.Reactive: https://github.com/Code-Sharp/WampSharp/issues/224 He asked me to try to reference the .NET Standard 2.0 dlls, which means I would have to wait for the 2018 Beta.
I got the same InvalidCastException in my app. My app refers to System.Reactive.Core/Linq/Interface 3.1.1 nuget packages. The static constructor of the Observable class in System.Reactive.Core tries to load System.Reactive.PlatformServices by reflection if it exists. In Unity, the PlatformServices is found in MonoBleedingEdge/lib/mono/4.5 but its version is 2.2.0. And then, the cast is invalid because of loading the same class from other versions.