signalr Handling Connection Lifetimes Example of informing others in a group that a user has disconnected

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

    /// <summary>
    /// Overrides the onDisconnected function and sets the user object to offline, this can be checked when other players interacts with them...
    /// </summary>
    /// <param name="stopCalled"></param>
    /// <returns></returns>
    public override Task OnDisconnected(bool stopCalled)
    {
        var user = GetUserDictionaryData();
        if (user != null)
        {
            user.Status = PlayerStatus.offline;
            var playerJson = ReturnObjectAsJSON(user.Player);
            Clients.OthersInGroup(user.GroupId).userDisconnected(playerJson);
        }

        return base.OnDisconnected(stopCalled);
    }


Got any signalr Question?