Class ChannelBase

java.lang.Object
io.ably.lib.rest.ChannelBase
Direct Known Subclasses:
Channel

public class ChannelBase
extends java.lang.Object
A class representing a Channel in the Ably REST API. In the REST API, the library is essentially stateless; a Channel object simply represents a channel for making REST requests, and existence of a channel does not signify that there is a realtime connection or attachment to that channel.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    class  ChannelBase.Presence
    Enables the retrieval of the current and historic presence set for a channel.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    java.lang.String name
    The Channel name
    ChannelBase.Presence presence
    The presence instance for this channel.
  • Method Summary

    Modifier and Type Method Description
    PaginatedResult<Message> history​(Param[] params)
    Obtain recent history for this channel using the REST API.
    void historyAsync​(Param[] params, Callback<AsyncPaginatedResult<Message>> callback)
    Asynchronously obtain recent history for this channel using the REST API.
    void publish​(Message[] messages)
    Publish an array of messages on this channel.
    void publish​(java.lang.String name, java.lang.Object data)
    Publish a message on this channel using the REST API.
    void publishAsync​(Message[] messages, CompletionListener listener)
    Asynchronously publish an array of messages on this channel
    void publishAsync​(java.lang.String name, java.lang.Object data, CompletionListener listener)
    Publish a message on this channel using the REST API.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • publish

      public void publish​(java.lang.String name, java.lang.Object data) throws AblyException
      Publish a message on this channel using the REST API. Since the REST API is stateless, this request is made independently of any other request on this or any other channel.
      Parameters:
      name - the event name
      data - the message payload; see io.ably.types.Data for details of supported data types.
      Throws:
      AblyException
    • publishAsync

      public void publishAsync​(java.lang.String name, java.lang.Object data, CompletionListener listener)
      Publish a message on this channel using the REST API. Since the REST API is stateless, this request is made independently of any other request on this or any other channel.
      Parameters:
      name - the event name
      data - the message payload; see io.ably.types.Data for
      listener - a listener to be notified of the outcome of this message.

      This listener is invoked on a background thread.

    • publish

      public void publish​(Message[] messages) throws AblyException
      Publish an array of messages on this channel. When there are multiple messages to be sent, it is more efficient to use this method to publish them in a single request, as compared with publishing via multiple independent requests.
      Parameters:
      messages - array of messages to publish.
      Throws:
      AblyException
    • publishAsync

      public void publishAsync​(Message[] messages, CompletionListener listener)
      Asynchronously publish an array of messages on this channel
      Parameters:
      messages - the message
      listener - a listener to be notified of the outcome of this message.

      This listener is invoked on a background thread.

    • history

      public PaginatedResult<Message> history​(Param[] params) throws AblyException
      Obtain recent history for this channel using the REST API. The history provided relqtes to all clients of this application, not just this instance.
      Parameters:
      params - the request params. See the Ably REST API documentation for more details.
      Returns:
      an array of Messages for this Channel.
      Throws:
      AblyException
    • historyAsync

      public void historyAsync​(Param[] params, Callback<AsyncPaginatedResult<Message>> callback)
      Asynchronously obtain recent history for this channel using the REST API.
      Parameters:
      params - the request params. See the Ably REST API
      callback -