Support other Serializers for SignalR Protocol so we can support Trimming/AOT #60061
-
It looks like MessagePack does not support trimming/AOT. MemoryPack does work with these when types have proper annotations, and is a very fast sterilizer which goes great with high performance WebSockets, but as far as I understand it's not possible to specify a custom serializer for SignalR. It might kill two birds with one stone to define an interface that SignalR needs from a serializer so that we can map other serializers to it, and in turn have a high performance serializer over WebSockets which also support tirmming/AOT. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is an interface, I would recommend not using MemoryPack though, it is not a safe serializer. |
Beta Was this translation helpful? Give feedback.
There is an interface,
IHubProtocol
. Just add it to the service provider and configure your client(s) to use that protocol as well. e.g. https://source.dot.net/#Microsoft.AspNetCore.SignalR.Protocols.Json/JsonProtocolDependencyInjectionExtensions.cs,38I would recommend not using MemoryPack though, it is not a safe serializer.