signalR – getting username

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

Gets the user that was part of the initial http 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);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)