I had been with this pending task about a year, and a month ago i decided to implement message pack on library pushed by an issue on github´s library. These was my original plans, but i´ve been procrastinating it to this weekend.
As it can read on title, my implementation was SignalR message pack protocol. First i need to be thankful to the user @ Apollo3zehn on git. That implementation helped me a lot!. If you want see implementation details you can check library´s github. There is also the @Apollo3zehn´s fork, the links are below.
The example
The example will be the most simple, a chat. I don't want to make something too long because i have wrote a lot of examples in my library´s examples or previous posts.
Server configuration
This configuration is only for message pack. A full example can be found here.
CSPROJ
Add signalr message pack dependency
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="3.1.4" />
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
/// ...
services
.AddSignalR()
.AddMessagePackProtocol();
/// ...
}
Python client configuration
Python client syntax is like javascript´s signalr client. This example is an interactive chat (like MS examples). If you have worked with library the only thing you must add to builder config is the following
from signalrcore.protocol.messagepack_protocol import MessagePackHubProtocol
#
hub_connection = HubConnectionBuilder()\
# ...
.with_hub_protocol(MessagePackHubProtocol())
# ... builder config
A full working example is avaible here
Links
Thank you for reading, and write any thought below :D
Top comments (0)