Open Closed

Trying out new SignalR / Notifications #792

joemo created

Hi, Following your new example documents, I can add signalr and publish/subscribe to a simple notification. And I can see in browser Console that signalR is connected and registered.

However if I add this to header.js:-

abp.event.on('abp.notifications.received', function (userNotification) {
                console.log("notification!", userNotification);

... nothing fires. I can see the notification and subscriptions being added to the SQL tables, but still nothing fires on the client side. In the logs I get the error "There is no notification definition with given name: CustomerCreated".

This is how I subscribe:-

await _notificationSubscriptionManager.SubscribeAsync(1, 3, "CustomerCreated");

And this is how I publish:-

public async Task Publish_CustomerCreated(string CustomerName, int CustomerId)
            var data = new LocalizableMessageNotificationData(new LocalizableString("CustomerCreatedMessage", "BlueHarvest"));
            data["CustomerName"] = CustomerName;
            data["CustomerId"] = CustomerId;

            await _notificationPublisher.PublishAsync("CustomerCreated", data, severity: NotificationSeverity.Warn);

1 Answer(s)
  • 0
    hikalkan created
    Support Team

    Thank you so much for informing me. You found a bug! <a class="postlink" href=""> ... issues/881</a> I fixed it and will release in a very short time.

    For a workaround, you can define your notification: <a class="postlink" href=""> ... efinitions</a>