public override async Task OnReconnected() { try { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get <Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve <IMessagesHubEvents>().OnReconnected(this); } finally { await base.OnReconnected(); } }
public override async Task OnDisconnected(bool stopCalled) { try { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get <Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve <IMessagesHubEvents>().OnDisconnected(this, stopCalled); } catch (ObjectDisposedException) { /* https://github.com/SignalR/SignalR/issues/2972 */ } finally { await base.OnDisconnected(stopCalled); } }
public virtual async Task RaiseAsync <T>(Event <T> @event) { if (@event.EventType == EventTypes.Error || @event.EventType == EventTypes.Failure) { using (Core.Contracts.IDependencyResolver resolver = DependencyManager.CreateChildDependencyResolver()) { ILogger logger = resolver.Resolve <ILogger>(); logger.AddLogData(nameof(EventContext.ActivityId), @event.Context.ActivityId); logger.AddLogData(nameof(EventContext.RemoteIpAddress), @event.Context.RemoteIpAddress); logger.AddLogData(nameof(EventContext.SubjectId), @event.Context.SubjectId); logger.AddLogData(nameof(Event <object> .Category), @event.Category); logger.AddLogData("IdentityServerEventId", @event.Id); logger.AddLogData(nameof(Event <object> .Name), @event.Name); await logger.LogFatalAsync(@event.Message).ConfigureAwait(false); } } }
public override async Task OnReconnected() { try { IOwinContext context = new OwinContext(Context.Request.Environment); if (context.Request.CallCancelled.IsCancellationRequested == true) { return; } Core.Contracts.IDependencyResolver dependencyResolver = context.GetDependencyResolver(); await dependencyResolver.Resolve <IMessagesHubEvents>().OnReconnected(this); } finally { await base.OnReconnected(); } }
public override async Task OnDisconnected(bool stopCalled) { try { IOwinContext context = new OwinContext(Context.Request.Environment); if (context.Request.CallCancelled.IsCancellationRequested == true) { return; } Core.Contracts.IDependencyResolver dependencyResolver = context.GetDependencyResolver(); if (dependencyResolver != null) { await dependencyResolver?.Resolve <IMessagesHubEvents>().OnDisconnected(this, stopCalled); } } catch (ObjectDisposedException) { /* https://github.com/SignalR/SignalR/issues/2972 */ } finally { await base.OnDisconnected(stopCalled); } }