private async void OnUserAuthorisationChanged(object sender, AuthorisationChangedArgs args) { if (Connection == null) { return; } if (Connection.Headers.ContainsKey(UserIdentity.AUTHORISATION_HEADER)) { Connection.Headers.Remove(UserIdentity.AUTHORISATION_HEADER); } try { if (args.Identity != null) { Connection.Headers.Add(UserIdentity.AUTHORISATION_HEADER, args.Identity.Id.GetHashCode().ToString()); var connectionId = await Hub.Invoke <string>(SignalRHub.Events.Account.RegisterClient, args.Identity); args.Identity.ConnectionId = connectionId; } else { await Hub.Invoke(SignalRHub.Events.Account.RemoveClient); } } catch (Exception ex) { GlobalHandler.Catch(ex); } }
private void CheckAuthorisation(object sender, AuthorisationChangedArgs authorisationChangedArgs) { CheckAuthorisation(); }