Package 

Class RealtimeAnnotations


  • 
    public class RealtimeAnnotations
    
                        

    RealtimeAnnotation provides subscription capabilities for annotations received on a channel. It allows adding or removing listeners to handle annotation events and facilitates broadcasting those events to the appropriate listeners.

    Note: This is an experimental API. While the underlying functionality is stable, the public API may change in future releases.

    • Method Detail

      • publish

         void publish(String messageSerial, Annotation annotation, CompletionListener listener)

        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
      • publish

         void publish(String messageSerial, Annotation annotation)

        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
      • delete

         void delete(String messageSerial, Annotation annotation, CompletionListener listener)

        Deletes an annotation associated with the specified message serial.Sets the annotation action to `ANNOTATION_DELETE` and publishes theupdate 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
      • get

         PaginatedResult<Annotation> get(String messageSerial, Array<Param> params)

        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.
      • get

         PaginatedResult<Annotation> get(String messageSerial)

        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
      • getAsync

         void getAsync(String messageSerial, Array<Param> params, Callback<AsyncPaginatedResult<Annotation>> callback)

        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 an AsyncPaginatedResult containing the matching annotations.
      • getAsync

         void getAsync(String messageSerial, Callback<AsyncPaginatedResult<Annotation>> callback)

        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 an AsyncPaginatedResult containing the matching annotations.
      • subscribe

         synchronized void subscribe(RealtimeAnnotations.AnnotationListener listener)

        Subscribes the given 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
      • unsubscribe

         synchronized void unsubscribe(RealtimeAnnotations.AnnotationListener listener)

        Unsubscribes the specified AnnotationListener from the channel, stopping itfrom receiving further annotations. Any corresponding type-specific listenersassociated 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 - the AnnotationListener to be unsubscribed
      • subscribe

         synchronized void subscribe(String type, RealtimeAnnotations.AnnotationListener listener)

        Subscribes the given AnnotationListener to the channel for a specific annotation type,allowing it to receive annotations of the specified type. If the channel's attach on subscribeoption 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 - the AnnotationListener to be subscribed
      • unsubscribe

         synchronized void unsubscribe(String type, RealtimeAnnotations.AnnotationListener listener)

        Unsubscribes the specified AnnotationListener from receiving annotationsof a particular type within the channel. If there are no remaining listenersfor 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, unsubscribesfrom all annotations associated with the listener
        listener - the AnnotationListener to be unsubscribed
      • onAnnotation

         void onAnnotation(ProtocolMessage protocolMessage)

        Internal method. Handles incoming annotation messages from the protocol layer.

        Parameters:
        protocolMessage - the protocol message containing annotation data