New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signal R callback not working #2135
Comments
Hi, Can you share some code. A general message like "not working" does not help us to understand your special case since for most of us it just works. Also, please write your help requests to the forum: https://forum.aspnetboilerplate.com/viewforum.php?f=2 |
Thought to re-open this because I experience a similar problem. This is what I did.
Since I use the same notification name (abp.notifications.received) on server and client, I was expecting it to show the console.log message in client side. But it doesn't. No errors on both ends. Am I raising the events correctly on server side? |
As per the documentation, you need to subscribe to the notification name or publish to specific users. |
After you pointed out about subscribing to my event (raised at the server) I changed the code as below.
await _notificationPublisher.PublishAsync("mail.sent", new MessageNotificationData($"Invitation sent to {to}")
Still it doesn't work :( I am 100% sure that SignarR libraries are all set and it connects properly to server. Just that it doesn't seem to publish/subscribe. |
By subscribe, I mean subscribe to notifications: //Subscribe to a general notification
public async Task Subscribe_SentFrendshipRequest(int? tenantId, long userId)
{
await _notificationSubscriptionManager.SubscribeAsync(new UserIdentifier(tenantId, userId), > "SentFrendshipRequest");
}
The notification name on the server (your choice — |
Ok, I think i am not getting the documentation right to my brain. What I am trying to do is to push a message to browser from the server ApplicationService when an email is sent successfully from the server. So, to get myself clarified, if I can raise the event from the server (from inside a method in an ApplicationService like; does the ABP framework publish that to every connected client(unless I specifically mention a tenant/userid)? If so, at the client side it should fire; What I am wondering is why i should subscribe again on the server as you have mentioned below; Do you have a sample that works? |
If you don't specify userIds, ABP publishes to subscribers. If you don't subscribe, you don't receive.
I've already made clear the difference between subscribe and listen. |
I am very sorry If my question(s) annoy you. It's just that my head was used to map with how I got a similar thing done with node + socksjs. In that I simply publish an event at server and any client code subscribe to that event and things simply works. Anyway let me show my code sample in brief (what I did after your above comment). I have a service done as AppService. In this I have the publish method
I call above method from elsewhere in the code. In another service, I subscribe as below.
This is similar to what the documentation says. But I don't see anything happening. No errors either. A sample code would help me to understand what I am doing wrong. |
Did you subscribe before publishing? Is subscription saved in DB? |
Ah! Great blunder. No it's not saved in the db. Because I haven't used INotificatioinStore! I was under the impression that there is a default in-memory pub/sub setup!!!! Ok, so let me see whether I get this right.
|
@mkgn INotificationStore is implemented https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.Zero.Common/Notifications/NotificationStore.cs |
Please I developed an application using a the latest version of abp, did signalr r integrate, but my client method in my JavaScript are not been call nor executed, and no error is been encountered. Any suggestions on how to solve this issue
The text was updated successfully, but these errors were encountered: