ABP 4.3.0 Blazor
In other Blazor server projects I have used the following technique to communicate between background servces and the pages
https://dzone.com/articles/blazor-how-tos-status-from-a-background-task
An alternate to this would be sockets but I would prefer to use
@code{
protected override void OnInitialized()
{
State.OnChangeAsync += Refresh;
}
private async Task Refresh()
{
await InvokeAsync(StateHasChanged);
}
public void Dispose()
{
State.OnChangeAsync -= Refresh;
}
}
Do you know iif this approach will work with Blazor WASM or should I fallback to traditional SignalR sockets
Many thanks in advance
J
3 Answer(s)
-
0
@nowayja for my late response, @mladen will that work?
-
0
The way of how you re-render component with
StateHasChanged
is the same with both Blazor WASM and Blazor Server projects. There is no diference there. But, since you mention SignalR, that is only possible with Blazor Server by default.If you want to have SIgnalR for Blazor WASM you will need to implement it in your project. Here is one way on how to implement it https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr-blazor?view=aspnetcore-5.0&tabs=visual-studio&pivots=webassembly
-
0
This question has been automatically marked as stale because it has not had recent activity.