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

The @microsoft/signalr-protocol-msgpack npm package now references @msgpack/msgpack instead of msgpack5. Additionally, the available options that can optionally be passed into the MessagePackHubProtocol have changed. The MessagePackOptions.disableTimestampEncoding and MessagePackOptions.forceFloat64 properties were removed, and some new options were added.

For discussion, see https://github.com/dotnet/aspnetcore/issues/30471.

Version introduced

ASP.NET Core 6.0

Old behavior

In previous versions, you must include three script references to use the MessagePack Hub Protocol in the browser:

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

New behavior

Starting in ASP.NET Core 6, you only need two script references to use the MessagePack Hub Protocol in the browser:

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

Instead of the msgpack5 package, the @msgpack/msgpack package is downloaded to your node_modules directory if you want to use it directly in your app.

Finally, MessagePackOptions has new, additional properties, and the disableTimestampEncoding and forceFloat64 properties are removed.

Reason for change

This change was made to reduce asset size, make it simpler to consume the package, and add more customizability.

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

Affected APIs

The following APIs were removed:

  • MessagePackOptions.disableTimestampEncoding
  • MessagePackOptions.forceFloat64