dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.49k stars 10.04k forks source link

[Discussion] Changed MessagePack library in @microsoft/signalr-protocol-msgpack javascript library #30471

Closed BrennanConroy closed 3 years ago

BrennanConroy commented 3 years ago

Discussion for https://github.com/aspnet/Announcements/issues/454

Changed MessagePack library in @microsoft/signalr-protocol-msgpack npm package

@microsoft/signalr-protocol-msgpack used to reference msgpack5 now it references @msgpack/msgpack.

The MessagePackOptions that could optionally be passed into the MessagePackHubProtocol also has a breaking change. The options disableTimestampEncoding and forceFloat64 no longer exist, and some additional options now exist.

Version introduced

ASP.NET Core 6.0

Old behavior

Previously to use the MessagePack hub protocol in the browser you needed to include 3 script references

<script src="~/lib/signalr/signalr.js"></script>
<script src="~/lib/msgpack5/msgpack5.js"></script>
<script src="~/lib/signalr/signalr-protocol-msgpack.js"></script>

In addition the msgpack5 package was downloaded to your node_modules so you could use it in your app if you wanted.

MessagePackOptions had disableTimestampEncoding and forceFloat64 properties, but doesn't anymore.

New behavior

To use the MessagePack hub protocol in the browser you now only need 2 script references

<script src="~/lib/signalr/signalr.js"></script>
<script src="~/lib/signalr/signalr-protocol-msgpack.js"></script>

And you will have the @msgpack/msgpack package downloaded to your node_modules if you want to use the directly in your app.

MessagePackOptions has new properties and removed the disableTimestampEncoding and forceFloat64 properties.

Reason for change

Reduced asset size, reduced complexity to consume the package, and more customizability.

Recommended action

If you were previously using msgpack5 in your app, you will need to add a direct reference to the library in your package.json.

Category

ASP.NET

Affected APIs

Removed MessagePackOptions.disableTimestampEncoding Removed MessagePackOptions.forceFloat64


Issue metadata

John0King commented 3 years ago

May I ask your guys put the client side code in a stand alone github repository ? AspNetCore repo is a huge git repo , and I will hard to the diff. I'm porting signalR to wechat miniProgram and uni-app,

and I'm asking the ability to replace websocket protocol so I don't need to port all the code from this repo, then I can only port https://github.com/John0King/WeChatApp.SignalR/blob/master/signalr/src/WeChatWebSocketTransport.ts and https://github.com/John0King/WeChatApp.SignalR/blob/master/signalr/src/WeChatHttpClient.ts

BrennanConroy commented 3 years ago

put the client side code in a stand alone github repository

That's unlikely to happen. You can view the history for specific folders on Github, so you should be able to just monitor https://github.com/dotnet/aspnetcore/commits/main/src/SignalR/clients/ts for changes.

ghost commented 3 years ago

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!