Open Closed

SignalR message that is invoked during a long-running process not updating the Razor View #3695


User avatar
0
joe@tronactive.com created
  • ABP Framework version: v5.3.4
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Single Layer template

I am trying to send a SignalR message that is invoked during a long-running process within a loop back to a Razor page so I can show output in the Razor view of what is going on while processing files. Kind of like when you run a Pipeline in Azure DevOps, and it shows outputs like you would see on a console application.

I cannot get this to ever trigger a state change, nothing happens on the UI. I have tried adding this InvokeAsync(() => StateHasChanged()); after the message has been sent back to the code behind the component. But that doesn't work either.One thing I found odd was that this BroadcastMessage() method doesn't get hit until I manually refresh the page. Then it seems to find the correct SignalR connection to at least hit this method. But still nothing changes on the UI. Any help would be greatly appreciated.

private void BroadcastMessage(string name, string message)
{
    _message = message;
    InvokeAsync(() => StateHasChanged());
}

2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you share the full steps or a project that can reproduce the problem with me? shiwei.liang@volosoft.com thanks

  • User Avatar
    0
    joe@tronactive.com created

    I couldn't get this to work using normal SignalR messaging. So I implemented more of an event-based strategy which allowed me to notify the subscriber(component) of a change, and then I was able to change the UI. Not sure why I couldn't get this to work through the SignalR hub.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11