Last post Aug 05, 2014 05:21 PM by halter73
Aug 05, 2014 08:16 AM|Azkel|LINK
I use Connection Manager to call hub from my controller using following code:
var hub = GlobalHost.ConnectionManager.GetHubContext<MyProject.MyHub>();hub.Clients.Group(User.Identity.GetUserId()).userLoggedOut();
And keep ConnectionId of Users in Groups called like UserId
public override Task OnConnected()
string name = Context.User.Identity.GetUserId();
Now this code is responsible for showing user an alert on all his windows that he was logged out. My problem is that it should not show that alert on windo that user clicked 'log out' on. On Hub class I could of course use code mentioned below to skip current
Still, this method is unavailable from HubContext. Can you guys give me any hints about how to use something similar in my Controller?
Aug 05, 2014 05:21 PM|halter73|LINK
The IHubContext returned from GetHubContext does not include OthersInGroup, because it is not obvious what the ConnectionId of the caller is outside of a Hub.
If you send the caller's SignalR ConnectionId to the Controller method, you should be able to achieve the same affect by passing in an excluded ConnectionId to
var hub = GlobalHost.ConnectionManager.GetHubContext<MyProject.MyHub>();