Base solution for your next web application
Open Closed

publish notification only for Signal R #12489


User avatar
0
ricardo created

Hi,

I would like to publish a notification only to Signal R clients and ignore other notifiers.

but we are unable to correctly indicate the targetNotifier type of Signal R:

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ricardo

    Getting a Type object is to use the typeof operator. It's evaluated at compile-time, which makes it faster, safer, and less prone to runtime errors from typos in "magic strings".

    Instead of using Type.GetType, directly use typeof. You will need to add a using statement for the correct namespace at the top of your file.

    using Abp.AspNetCore.SignalR.Notifications;
    
    var signalRNotifierType = typeof(SignalRRealTimeNotifier);
    

    If you misspell the class name SignalRRealTimeNotifier, your project will not compile, and you'll know about the error immediately. With the string based approach, you only discover the error at runtime when the code executes and fails.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)