-
public class ChannelBaseA 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 public classChannelBase.PresenceEnables the retrieval of the current and historic presence set for a channel.
-
Field Summary
Fields Modifier and Type Field Description public final Stringnamepublic final ChannelBase.Presencepresencepublic final RestAnnotationsannotations
-
Method Summary
Modifier and Type Method Description voidpublish(String name, Object data)Publish a message on this channel using the REST API.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel. PublishResultpublishWithResult(String name, Object data)Publish a message on this channel using the REST API and return the result.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel. voidpublishAsync(String name, Object data, CompletionListener listener)Publish a message on this channel using the REST API.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel. voidpublishAsync(String name, Object data, Callback<PublishResult> callback)Asynchronously publish a message on this channel using the REST API.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel. voidpublish(Array<Message> messages)Publish an array of messages on this channel. PublishResultpublishWithResult(Array<Message> messages)Publish an array of messages on this channel. voidpublishAsync(Array<Message> messages, CompletionListener listener)Asynchronously publish an array of messages on this channel voidpublishAsync(Array<Message> messages, Callback<PublishResult> callback)Asynchronously publish an array of messages on this channel PaginatedResult<Message>history(Array<Param> params)Obtain recent history for this channel using the REST API.The history provided relqtes to all clients of this application,not just this instance. voidhistoryAsync(Array<Param> params, Callback<AsyncPaginatedResult<Message>> callback)Asynchronously obtain recent history for this channel using the REST API. MessagegetMessage(String serial)Retrieves the latest version of a specific message by its serial identifier. voidgetMessageAsync(String serial, Callback<Message> callback)Asynchronously retrieves the latest version of a specific message by its serial identifier. UpdateDeleteResultupdateMessage(Message message, MessageOperation operation)Updates an existing message using patch semantics. UpdateDeleteResultupdateMessage(Message message)Updates an existing message using patch semantics. voidupdateMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)Asynchronously updates an existing message. voidupdateMessageAsync(Message message, Callback<UpdateDeleteResult> callback)Asynchronously updates an existing message. UpdateDeleteResultdeleteMessage(Message message, MessageOperation operation)Marks a message as deleted. UpdateDeleteResultdeleteMessage(Message message)Marks a message as deleted. voiddeleteMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)Asynchronously marks a message as deleted. voiddeleteMessageAsync(Message message, Callback<UpdateDeleteResult> callback)Asynchronously marks a message as deleted. UpdateDeleteResultappendMessage(Message message, MessageOperation operation)Appends message text to the end of the message. UpdateDeleteResultappendMessage(Message message)Appends message text to the end of the message. voidappendMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)Asynchronously appends message text to the end of the message. voidappendMessageAsync(Message message, Callback<UpdateDeleteResult> callback)Asynchronously appends message text to the end of the message. PaginatedResult<Message>getMessageVersions(String serial, Array<Param> params)Retrieves all historical versions of a specific message. voidgetMessageVersionsAsync(String serial, Array<Param> params, Callback<AsyncPaginatedResult<Message>> callback)Asynchronously retrieves all historical versions of a specific message. -
-
Method Detail
-
publish
@Blocking() void publish(String name, Object data)
Publish a message on this channel using the REST API.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel.
- Parameters:
name- the event namedata- the message payload;
-
publishWithResult
@Blocking() PublishResult publishWithResult(String name, Object data)
Publish a message on this channel using the REST API and return the result.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel.
- Parameters:
name- the event namedata- the message payload;
-
publishAsync
@Deprecated() void publishAsync(String name, Object data, CompletionListener listener)
Publish a message on this channel using the REST API.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel.
- Parameters:
name- the event namedata- the message payload;listener- a listener to be notified of the outcome of this message.
-
publishAsync
@NonBlocking() void publishAsync(String name, Object data, Callback<PublishResult> callback)
Asynchronously publish a message on this channel using the REST API.Since the REST API is stateless, this request is made independentlyof any other request on this or any other channel.
- Parameters:
name- the event namedata- the message payload;callback- a callback to be notified of the outcome of this message with the PublishResult.
-
publish
@Blocking() void publish(Array<Message> messages)
Publish an array of messages on this channel. When there aremultiple messages to be sent, it is more efficient to use thismethod to publish them in a single request, as compared withpublishing via multiple independent requests.
- Parameters:
messages- array of messages to publish.
-
publishWithResult
@Blocking() PublishResult publishWithResult(Array<Message> messages)
Publish an array of messages on this channel. When there aremultiple messages to be sent, it is more efficient to use thismethod to publish them in a single request, as compared withpublishing via multiple independent requests.
- Parameters:
messages- array of messages to publish.
-
publishAsync
@Deprecated()@NonBlocking() void publishAsync(Array<Message> messages, CompletionListener listener)
Asynchronously publish an array of messages on this channel
- Parameters:
messages- the messagelistener- a listener to be notified of the outcome of this message.
-
publishAsync
@NonBlocking() void publishAsync(Array<Message> messages, Callback<PublishResult> callback)
Asynchronously publish an array of messages on this channel
- Parameters:
messages- the messagecallback- a callback to be notified of the outcome of this message.
-
history
PaginatedResult<Message> history(Array<Param> params)
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.
-
historyAsync
void historyAsync(Array<Param> params, Callback<AsyncPaginatedResult<Message>> callback)
Asynchronously obtain recent history for this channel using the REST API.
- Parameters:
params- the request params.
-
getMessage
@Blocking() Message getMessage(String serial)
Retrieves the latest version of a specific message by its serial identifier.
This method allows you to fetch the current state of a message, including any updatesor deletions that have been applied since its creation.
- Parameters:
serial- The unique serial identifier of the message to retrieve.
-
getMessageAsync
@NonBlocking() void getMessageAsync(String serial, Callback<Message> callback)
Asynchronously retrieves the latest version of a specific message by its serial identifier.
- Parameters:
serial- The unique serial identifier of the message to retrieve.callback- A callback to handle the result asynchronously.
-
updateMessage
@Blocking() UpdateDeleteResult updateMessage(Message message, MessageOperation operation)
Updates an existing message using patch semantics.
Non-null fields in the provided message (name, data, extras) will replace the correspondingfields in the existing message, while null fields will be left unchanged.
- Parameters:
message- A Message object containing the fields to update and the serial identifier.Only non-null fields will be applied to the existing message.operation- operation metadata such as clientId, description, or metadata in the version field
-
updateMessage
@Blocking() UpdateDeleteResult updateMessage(Message message)
Updates an existing message using patch semantics.
Non-null fields in the provided message (name, data, extras) will replace the correspondingfields in the existing message, while null fields will be left unchanged.
- Parameters:
message- A Message object containing the fields to update and the serial identifier.Only non-null fields will be applied to the existing message.
-
updateMessageAsync
@NonBlocking() void updateMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)
Asynchronously updates an existing message.
- Parameters:
message- A Message object containing the fields to update and the serial identifier.operation- operation metadata such as clientId, description, or metadata in the version fieldcallback- A callback to be notified of the outcome of this operation.
-
updateMessageAsync
@NonBlocking() void updateMessageAsync(Message message, Callback<UpdateDeleteResult> callback)
Asynchronously updates an existing message.
- Parameters:
message- A Message object containing the fields to update and the serial identifier.callback- A callback to be notified of the outcome of this operation.
-
deleteMessage
@Blocking() UpdateDeleteResult deleteMessage(Message message, MessageOperation operation)
Marks a message as deleted.
This operation does not remove the message from history; it marks it as deletedwhile preserving the full message history. The deleted message can still beretrieved and will have its action set to MESSAGE_DELETE.
- Parameters:
message- A Message message containing the serial identifier.operation- operation metadata such as clientId, description, or metadata in the version field
-
deleteMessage
@Blocking() UpdateDeleteResult deleteMessage(Message message)
Marks a message as deleted.
This operation does not remove the message from history; it marks it as deletedwhile preserving the full message history. The deleted message can still beretrieved and will have its action set to MESSAGE_DELETE.
- Parameters:
message- A Message message containing the serial identifier.
-
deleteMessageAsync
@NonBlocking() void deleteMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)
Asynchronously marks a message as deleted.
- Parameters:
message- A Message object containing the serial identifier and operation metadata.operation- operation metadata such as clientId, description, or metadata in the version fieldcallback- A callback to be notified of the outcome of this operation.
-
deleteMessageAsync
@NonBlocking() void deleteMessageAsync(Message message, Callback<UpdateDeleteResult> callback)
Asynchronously marks a message as deleted.
- Parameters:
message- A Message object containing the serial identifier and operation metadata.callback- A callback to be notified of the outcome of this operation.
-
appendMessage
@Blocking() UpdateDeleteResult appendMessage(Message message, MessageOperation operation)
Appends message text to the end of the message.
- Parameters:
message- A Message object containing the serial identifier and data to append.operation- operation details such as clientId, description, or metadata
-
appendMessage
@Blocking() UpdateDeleteResult appendMessage(Message message)
Appends message text to the end of the message.
- Parameters:
message- A Message object containing the serial identifier and data to append.
-
appendMessageAsync
@NonBlocking() void appendMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)
Asynchronously appends message text to the end of the message.
- Parameters:
message- A Message object containing the serial identifier and data to append.operation- operation details such as clientId, description, or metadatacallback- A callback to be notified of the outcome of this operation.
-
appendMessageAsync
@NonBlocking() void appendMessageAsync(Message message, Callback<UpdateDeleteResult> callback)
Asynchronously appends message text to the end of the message.
- Parameters:
message- A Message object containing the serial identifier and data to append.callback- A callback to be notified of the outcome of this operation.
-
getMessageVersions
@Blocking() PaginatedResult<Message> getMessageVersions(String serial, Array<Param> params)
Retrieves all historical versions of a specific message.
This method returns a paginated result containing all versions of the message,ordered chronologically. Each version includes metadata about when and by whomthe message was modified.
- Parameters:
serial- The unique serial identifier of the message.params- Query parameters for filtering or pagination (e.g., limit, start, end).
-
getMessageVersionsAsync
@NonBlocking() void getMessageVersionsAsync(String serial, Array<Param> params, Callback<AsyncPaginatedResult<Message>> callback)
Asynchronously retrieves all historical versions of a specific message.
- Parameters:
serial- The unique serial identifier of the message.params- Query parameters for filtering or pagination.callback- A callback to handle the result asynchronously.
-
-
-
-