Question

I'm new to SignalR and I'm understand why when i close window, the OnDisconnected is called, and the Identity.Name is empty?

As well as the claims etc ...

override Task OnDisconnected()
{

 Context.User.Identity.Name

  var identity = (ClaimsPrincipal)Thread.CurrentPrincipal;
        string id = identity.Claims.Where(c => c.Type == UserInfoIdClaimType)
                                   .Select(c => c.Value).Single();

}

Altho here: http://www.asp.net/signalr/overview/signalr-20/hubs-api/mapping-users-to-connections they use this code to map user to id's, i mean if you have this issue with user closes one window, then you will always be stuck with this connection in the _connections :(

Any idea, why this?

Was it helpful?

Solution

You might be experiencing this bug: https://github.com/SignalR/SignalR/issues/2753

It seems to be specific to the WebSocket transport and should be fixed in SignalR 2.0.3 once it's released.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top