public async IAsyncEnumerable ListConnectionsInGroupAsync()

in src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionContainerBase.cs [253:281]


    public async IAsyncEnumerable<GroupMember> ListConnectionsInGroupAsync(string groupName, int? top = null, ulong? tracingId = null, [EnumeratorCancellation] CancellationToken token = default)
    {
        if (string.IsNullOrWhiteSpace(groupName))
        {
            throw new ArgumentException($"'{nameof(groupName)}' cannot be null or whitespace.", nameof(groupName));
        }
        if (top is not null and <= 0)
        {
            throw new ArgumentException($"'{nameof(top)}' must be greater than 0.", nameof(top));
        }
        var message = new GroupMemberQueryMessage() { GroupName = groupName, Top = top, TracingId = tracingId };
        do
        {
            var response = await InvokeAsync<GroupMemberQueryResponse>(message, token);
            foreach (var member in response.Members)
            {
                yield return member;
            }
            if (response.ContinuationToken == null)
            {
                yield break;
            }
            if (message.Top != null)
            {
                message.Top -= response.Members.Count;
            }
            message.ContinuationToken = response.ContinuationToken;
        } while (true);
    }