I'm having troubles to update only one specific user.
I'm working on some asp.net core web application and I want to implement push notification to my project. I'll explain a little more about what am i doing in my application.
I have a page where users can post something (like on facebook). On that post everyone can like/unlike it (like button) or comment it (can delete comments too). And my implementation of signalR on that part is working perfectly with await Clients.All.SendAsync("UpdateComments", userId, postId);
.
Now i want to send notification to the user whose post is.
I tries to do that on this way await Clients.User(userId).SendAsync("SendNotification", notificationText);
but not working. When i debuged it, on this part User(someId)
it expect me to send connectionId
which i don't have for user which i want to update. I have connectionId only for user who invoked current connection.
My question is: How can i update user with userId from my table or how can i get connectionId based on my userId? OR If i can't on any way to accomplish this, is there a way that i can automatically add user (when he log in to application) in some signalR group connection whithout need for user to activate connection by himself?
I googled a lot, but i didn't found answer. This is link which i followed to implement signalR in my app.