Open Closed

SignalR event all pages - Blazor #1147


User avatar
0
Leonardo.Willrich created
  • ABP Framework version: v4.2.3 rc.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

I need to hook up a SignalR event for every single page in my application. I was thinking to do that on the Layout page by method OnIntiliaze. However, the Layout code is not available, it is implemented in one of the NuGet packages and the only way to do that is by extending the razor component in my project and then creating the method.

I wonder if there is another way to do that?

In this scenario, the back-end will send a notification (disk full for example), and a toast/modal notification will be shown for users. Is there some example of how to do implement that?


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

    Hi,

    Better way is to overriding the layout: https://docs.abp.io/en/abp/4.3/UI/Blazor/Customization-Overriding-Components

    Is there some example of how to do implement that?

    No such example,you can refer the Use ASP.NET Core SignalR with Blazor document You can poll the signalr hub for disk information, and notify if the disk is full.

  • User Avatar
    0
    Leonardo.Willrich created

    Thank you for you answer liangshiwei.

    I've overriden the code as per documentation. I just affraid getting issues when updating the framework. It would be awesome having a callback function to onInitialize where we can create instances and hook up that to the main application.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09