/ SDKs / .NET
SDKs
Chat SDKs .NET v4
Chat SDKs .NET
Chat SDKs
.NET
Version 4

Retrieve the online status of a user

Copy link

You can check if a user in the Sendbird application is currently connected to the Sendbird server. For group channels only, you can check whether each member is currently connected to the server.

SbApplicationUserListQueryParams queryParams = new SbApplicationUserListQueryParams();
queryParams.UserIdsFilter = new List<string> { "Jane" }; // Added <string> for generic type

SbApplicationUserListQuery query = SendbirdChat.CreateApplicationUserListQuery(queryParams);
query.LoadNextPage((inUsers, inError) =>
{
    if (inError != null)
    {
        return; // Handle error.
    }

    // inUsers[0] is Jane.
    if (inUsers.First().ConnectionStatus == SbUserConnectionStatus.Online)
    {
        // Jane is currently online.
        // UserConnectionStatus consists of online, offline, and notAvailable.
    }
});