getOnlineUsers method

Future<PageUsersOnlineResponse?> getOnlineUsers(
  1. String tenantId,
  2. String urlId, [
  3. GetOnlineUsersOptions? options
])

Currently-online viewers of a page: people whose websocket session is subscribed to the page right now. Returns anonCount + totalCount (room-wide subscribers, including anon viewers we don't enumerate).

Parameters:

  • String tenantId (required):

  • String urlId (required): Page URL identifier (cleaned server-side).

  • String afterName: Cursor: pass nextAfterName from the previous response.

  • String afterUserId: Cursor tiebreaker: pass nextAfterUserId from the previous response. Required when afterName is set so name-ties don't drop entries.

Implementation

Future<PageUsersOnlineResponse?> getOnlineUsers(String tenantId, String urlId, [ GetOnlineUsersOptions? options ]) async {
  final response = await getOnlineUsersWithHttpInfo(tenantId, urlId, options);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'PageUsersOnlineResponse',) as PageUsersOnlineResponse;

  }
  return null;
}