Ejemplo n.º 1
0
        /// <summary>
        /// Handles when a client gets disconnected.
        /// </summary>
        /// <param name="stopCalled">True, if stop was called on the client closing the connection gracefully;
        /// false, if the connection has been lost for longer than the timeout.</param>
        /// <returns></returns>
        public override async Task OnDisconnectedAsync(Exception exception)
        {
            // Access VMController to set the ambient context.
            VMController _ = VMController;

            // Remove the controller on disconnection.
            _vmControllerFactory.Remove(Context.ConnectionId);

            // Allow middlewares to hook to the event.
            await _hubPipeline.RunDisconnectionMiddlewaresAsync(Context);

            await base.OnDisconnectedAsync(exception);
        }