Reputation: 132
Simply I have comments section, and when I post some comment to the database, signalr is calling a method on all clients.
var hub = GlobalHost.ConnectionManager.GetHubContext<NotificationsHub>();
hub.Clients.All.updateBlogComments(Mapper.Map<BlogCommentViewModel>(comment));
The problem is that when a user, who is just a visitor of the page and is not logged into the system, doesn't get called the client method updateBlogComments.
If there are 2 logged users visiting the same page, the method is called on both users, and there is no problem.But when a logged user posts a comment, the unauthorized user won't get the newly uploaded comment as it should.
How can I fix that.I want authorized and non-authorized users to see live comments uploading.
Thanks
Upvotes: 2
Views: 474
Reputation: 132
SOLVED.
I knowingly created a separate hub for this action which doesn't require authorization, but I forgot to change the name of the hubcontext, which I was taking, so instead of CommentsHub, I was still calling NotificationsHub.
Thanks to @Stilgar, for reminding me where the problem could be.
Upvotes: 2