Class RealtimeAnnotations
Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(Message message, Annotation annotation) void
delete
(Message message, Annotation annotation, CompletionListener listener) void
delete
(String messageSerial, Annotation annotation) void
delete
(String messageSerial, Annotation annotation, CompletionListener listener) Deletes an annotation associated with the specified message serial.Seeget(String)
Retrieves a paginated list of annotations associated with the specified message serial.Retrieves a paginated list of annotations associated with the specified message serial.void
getAsync
(Message message, Callback<AsyncPaginatedResult<Annotation>> callback) void
getAsync
(Message message, Param[] params, Callback<AsyncPaginatedResult<Annotation>> callback) void
getAsync
(String messageSerial, Callback<AsyncPaginatedResult<Annotation>> callback) Asynchronously retrieves a paginated list of annotations associated with the specified message serial.void
getAsync
(String messageSerial, Param[] params, Callback<AsyncPaginatedResult<Annotation>> callback) Asynchronously retrieves a paginated list of annotations associated with the specified message serial.void
onAnnotation
(ProtocolMessage protocolMessage) Internal method.void
publish
(Message message, Annotation annotation) void
publish
(Message message, Annotation annotation, CompletionListener listener) void
publish
(String messageSerial, Annotation annotation) Publishes an annotation to the specified channel with the given message serial.void
publish
(String messageSerial, Annotation annotation, CompletionListener listener) Publishes an annotation to the specified channel with the given message serial.void
Subscribes the givenRealtimeAnnotations.AnnotationListener
to the channel, allowing it to receive annotations.void
subscribe
(String type, RealtimeAnnotations.AnnotationListener listener) Subscribes the givenRealtimeAnnotations.AnnotationListener
to the channel for a specific annotation type, allowing it to receive annotations of the specified type.void
Unsubscribes the specifiedRealtimeAnnotations.AnnotationListener
from the channel, stopping it from receiving further annotations.void
unsubscribe
(String type, RealtimeAnnotations.AnnotationListener listener) Unsubscribes the specifiedRealtimeAnnotations.AnnotationListener
from receiving annotations of a particular type within the channel.
-
Constructor Details
-
RealtimeAnnotations
-
-
Method Details
-
publish
public void publish(String messageSerial, Annotation annotation, CompletionListener listener) throws AblyException Publishes an annotation to the specified channel with the given message serial. Validates and encodes the annotation before sending it as a protocol message.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message to be annotated -
annotation
- the annotation object associated with the message -
listener
- the completion listener to handle success or failure during the publish process - Throws:
-
AblyException
- if an error occurs during validation, encoding, or sending the annotation
-
publish
public void publish(Message message, Annotation annotation, CompletionListener listener) throws AblyException - Throws:
AblyException
-
publish
Publishes an annotation to the specified channel with the given message serial. Validates and encodes the annotation before sending it as a protocol message.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message to be annotated -
annotation
- the annotation object associated with the message - Throws:
-
AblyException
- if an error occurs during validation, encoding, or sending the annotation
-
publish
- Throws:
AblyException
-
delete
public void delete(String messageSerial, Annotation annotation, CompletionListener listener) throws AblyException Deletes an annotation associated with the specified message serial. Sets the annotation action to `ANNOTATION_DELETE` and publishes the update to the channel with the given completion listener.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message being annotated -
annotation
- the annotation object to be deleted -
listener
- the completion listener to handle success or failure during the deletion process - Throws:
-
AblyException
- if an error occurs during the deletion or publishing process
-
delete
public void delete(Message message, Annotation annotation, CompletionListener listener) throws AblyException - Throws:
AblyException
-
delete
- Throws:
AblyException
-
delete
- Throws:
AblyException
-
get
Retrieves a paginated list of annotations associated with the specified message serial.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message being annotated. -
params
- an array of query parameters for filtering or modifying the request. - Returns:
- a
PaginatedResult
containing the matching annotations. - Throws:
-
AblyException
- if an error occurs during the retrieval process.
-
get
- Throws:
AblyException
-
get
Retrieves a paginated list of annotations associated with the specified message serial.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message being annotated - Returns:
- a PaginatedResult containing the matching annotations
- Throws:
-
AblyException
- if an error occurs during the retrieval process
-
get
Seeget(String)
- Throws:
AblyException
-
getAsync
public void getAsync(String messageSerial, Param[] params, Callback<AsyncPaginatedResult<Annotation>> callback) throws AblyException Asynchronously retrieves a paginated list of annotations associated with the specified message serial.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message being annotated. -
params
- an array of query parameters for filtering or modifying the request. -
callback
- a callback to handle the result asynchronously, providing anAsyncPaginatedResult
containing the matching annotations. - Throws:
AblyException
-
getAsync
public void getAsync(Message message, Param[] params, Callback<AsyncPaginatedResult<Annotation>> callback) throws AblyException - Throws:
AblyException
-
getAsync
public void getAsync(String messageSerial, Callback<AsyncPaginatedResult<Annotation>> callback) throws AblyException Asynchronously retrieves a paginated list of annotations associated with the specified message serial.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
messageSerial
- the unique serial identifier for the message being annotated. -
callback
- a callback to handle the result asynchronously, providing anAsyncPaginatedResult
containing the matching annotations. - Throws:
AblyException
-
getAsync
public void getAsync(Message message, Callback<AsyncPaginatedResult<Annotation>> callback) throws AblyException - Throws:
AblyException
-
subscribe
Subscribes the givenRealtimeAnnotations.AnnotationListener
to the channel, allowing it to receive annotations. If the channel's attach on subscribe option is enabled, the channel is attached automatically.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
listener
- the listener to be subscribed to the channel - Throws:
-
AblyException
- if an error occurs during channel attachment
-
unsubscribe
Unsubscribes the specifiedRealtimeAnnotations.AnnotationListener
from the channel, stopping it from receiving further annotations. Any corresponding type-specific listeners associated with the listener are also removed.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
listener
- theRealtimeAnnotations.AnnotationListener
to be unsubscribed
-
subscribe
public void subscribe(String type, RealtimeAnnotations.AnnotationListener listener) throws AblyException Subscribes the givenRealtimeAnnotations.AnnotationListener
to the channel for a specific annotation type, allowing it to receive annotations of the specified type. If the channel's attach on subscribe option is enabled, the channel is attached automatically.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
type
- the specific annotation type to subscribe to; if null, subscribes to all types -
listener
- theRealtimeAnnotations.AnnotationListener
to be subscribed - Throws:
AblyException
-
unsubscribe
Unsubscribes the specifiedRealtimeAnnotations.AnnotationListener
from receiving annotations of a particular type within the channel. If there are no remaining listeners for the specified type, the type-specific listener collection is also removed.Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.
- Parameters:
-
type
- the specific annotation type to unsubscribe from; if null, unsubscribes from all annotations associated with the listener -
listener
- theRealtimeAnnotations.AnnotationListener
to be unsubscribed
-
onAnnotation
Internal method. Handles incoming annotation messages from the protocol layer.- Parameters:
-
protocolMessage
- the protocol message containing annotation data
-