ASP.NET SignalR connector for Blazor 3.0.0. (Not for ASP.NET Core SignalR)
- Install it from NuGet.
- Add jQuery reference to your HTML.
- Reference
_content/Shipwreck.BlazorSignalR/Shipwreck.BlazorSignalR.js
- Use
BlazorSignalRConnection
instead ofMicrosoft.AspNet.SignalR.Client.HubConnection
.
using Shipwreck.BlazorSignalR;
var connection = new BlazorSignalRConnection()
{
Url = "http://your/signalr",
QueryString = "authentication=if_needed"
};
var proxy = connection.CreatehubProxy("someHub");
proxy.On("Event1", YourCallbackMethod);
await connection.Start();
await proxy.Invoke<TResult>("Initialize", arg1, arg2);
- This depends on jQuery, jquery.signalR and Newtonsoft.Json. And jquery.signalR-2.4.1.js is bundled.
- Cannot subscribe(
IHubProxy.On
) or unscribe(IHubProxy.Off
) Hub after connection started.
The MIT License