Before starting to use SignalR, several things need to be sorted out first, namely, installing libraries locally.
Perform the following steps to begin this setup:
- First, install the Microsoft.AspNetCore.SignalR NuGet package.
- You also need a JavaScript library that is made available through npm (short for node package manager) as @microsoft/signalr.
- Once you install it, you need to copy the JavaScript file, either the minimized or the debug version to some folder under wwwroot, as it needs to be retrieved by the browser.
- The file containing the SignalR library is called signalr.js or signalr.min.js (for the minimized version) and it is available under node_modules/@aspnet/signalr/dist/browser.
- You will also require the @aspnet/signalr-protocol-msgpack package for using MessagePack serialization (more on this in a moment) if you wish to use it, but it's not strictly needed.