Package io.ably.lib.rest

Class ChannelBase.Presence

java.lang.Object
io.ably.lib.rest.ChannelBase.Presence
Enclosing class:
ChannelBase

public class ChannelBase.Presence extends Object
Enables the retrieval of the current and historic presence set for a channel.
  • Constructor Details

    • Presence

      public Presence()
  • Method Details

    • get

      public PaginatedResult<PresenceMessage> get(Param[] params) throws AblyException
      Retrieves the current members present on the channel and the metadata for each member, such as their PresenceMessage.Action and ID. Returns a PaginatedResult object, containing an array of PresenceMessage objects.

      Spec: RSPa

      Parameters:
      params - the request params:

      limit (RSP3a) - An upper limit on the number of messages returned. The default is 100, and the maximum is 1000.

      clientId (RSP3a2) - Filters the list of returned presence members by a specific client using its ID.

      connectionId (RSP3a3) - Filters the list of returned presence members by a specific connection using its ID.

      Returns:
      A PaginatedResult object containing an array of PresenceMessage objects.
      Throws:
      AblyException
    • getAsync

      public void getAsync(Param[] params, Callback<AsyncPaginatedResult<PresenceMessage>> callback)
      Asynchronously retrieves the current members present on the channel and the metadata for each member, such as their PresenceMessage.Action and ID. Returns a PaginatedResult object, containing an array of PresenceMessage objects.

      Spec: RSPa

      Parameters:
      params - the request params:

      limit (RSP3a) - An upper limit on the number of messages returned. The default is 100, and the maximum is 1000.

      clientId (RSP3a2) - Filters the list of returned presence members by a specific client using its ID.

      connectionId (RSP3a3) - Filters the list of returned presence members by a specific connection using its ID.

      callback - A Callback returning AsyncPaginatedResult object containing an array of PresenceMessage objects.

      This callback is invoked on a background thread.

    • history

      public PaginatedResult<PresenceMessage> history(Param[] params) throws AblyException
      Retrieves a PaginatedResult object, containing an array of historical PresenceMessage objects for the channel. If the channel is configured to persist messages, then presence messages can be retrieved from history for up to 72 hours in the past. If not, presence messages can only be retrieved from history for up to two minutes in the past.

      Spec: RSP4a

      Parameters:
      params - the request params:

      start (RSP4b1) - The time from which messages are retrieved, specified as milliseconds since the Unix epoch.

      end (RSP4b1) - The time until messages are retrieved, specified as milliseconds since the Unix epoch.

      direction (RSP4b2) - The order for which messages are returned in. Valid values are backwards which orders messages from most recent to oldest, or forwards which orders messages from oldest to most recent. The default is backwards. limit (RSP4b3) - An upper limit on the number of messages returned. The default is 100, and the maximum is 1000.

      Returns:
      A PaginatedResult object containing an array of PresenceMessage objects.
      Throws:
      AblyException
    • historyAsync

      public void historyAsync(Param[] params, Callback<AsyncPaginatedResult<PresenceMessage>> callback)
      Asynchronously retrieves a PaginatedResult object, containing an array of historical PresenceMessage objects for the channel. If the channel is configured to persist messages, then presence messages can be retrieved from history for up to 72 hours in the past. If not, presence messages can only be retrieved from history for up to two minutes in the past.

      Spec: RSP4a

      Parameters:
      params - the request params:

      start (RSP4b1) - The time from which messages are retrieved, specified as milliseconds since the Unix epoch.

      end (RSP4b1) - The time until messages are retrieved, specified as milliseconds since the Unix epoch.

      direction (RSP4b2) - The order for which messages are returned in. Valid values are backwards which orders messages from most recent to oldest, or forwards which orders messages from oldest to most recent. The default is backwards. limit (RSP4b3) - An upper limit on the number of messages returned. The default is 100, and the maximum is 1000.

      callback - A Callback returning AsyncPaginatedResult object containing an array of PresenceMessage objects.

      This callback is invoked on a background thread.

      Throws:
      AblyException