[ACCEPTED]-signalR - getting username-signalr-hub

Accepted answer
Score: 34

When using SignalR hubs you can use the HubCallerContext.User property to:

Gets 2 the user that was part of the initial http 1 request.

So try it with:

public Task Join()
    string username = Context.User.Identity.Name;
    //find group based on username
    string group = getGroup(username)
    return Groups.Add(Context.ConnectionId, group);

More Related questions