Exemple #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 Task OnDisconnectedAsync(Exception exception)
        {
            // Remove the controller on disconnection.
            _vmControllerFactory.Remove(Context.ConnectionId);

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

            return(base.OnDisconnectedAsync(exception));
        }
Exemple #2
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 Task OnDisconnected(bool stopCalled)
        {
            // Access VMController to set the ambient context.
            var controller = VMController;

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

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

            return(base.OnDisconnected(stopCalled));
        }