Share via

ASP.NET Core SignalR custom serialization

b_ioan 61 Reputation points
2022-11-17T11:54:35.76+00:00

Hello everybody!
I am working on a project that involves the use of SignalR technology in an application based on ASP.NET Core 6.0
I want to transmit data between client and server and vice versa using a custom serializer, and not using the default JSON option.
Is this scenario possible and what are the necessary steps that must be taken?
Any idea is welcome!

Developer technologies | ASP.NET | ASP.NET Core

Answer accepted by question author
  1. Lynn Niu 236 Reputation points
    2022-11-18T01:41:24.733+00:00

    ASP.NET Core SignalR supports two protocols for encoding messages: JSON and MessagePack. Try this: https://learn.microsoft.com/en-us/aspnet/core/signalr/messagepackhubprotocol

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 83,666 Reputation points
    2022-11-17T16:37:41.433+00:00

    Signal/r uses json for the message payload. You can not change this. But you can serialize to string that you pass via json.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.