Interface SseEvent

All Known Subinterfaces:
InboundSseEvent, OutboundSseEvent

public interface SseEvent
Base Server Sent Event definition.

This interface provides basic properties of the Server Sent Event, namely ID, Name, and Comment. It also provides access to the Reconnect delay property.

SseEvent is extended by another two interfaces, InboundSseEvent and OutboundSseEvent. The main difference is in how are instances created and how the stored data can be accessed (or provided).

Since:
2.1
Author:
Marek Potociar
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    A "reconnection not set" value for the SSE reconnect delay set via SSE event retry field.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get a comment string that accompanies the event.
    Get event identifier.
    Get event name.
    long
    Get new connection retry time in milliseconds the event receiver should wait before attempting to reconnect after a connection to the SSE event source is lost.
    boolean
    Check if the connection retry time has been set in the event.
  • Field Details

    • RECONNECT_NOT_SET

      static final long RECONNECT_NOT_SET
      A "reconnection not set" value for the SSE reconnect delay set via SSE event retry field.
      See Also:
  • Method Details

    • getId

      String getId()
      Get event identifier.

      Contains value of SSE "id" field. This field is optional. Method may return null, if the event identifier is not specified.

      Returns:
      event id.
    • getName

      String getName()
      Get event name.

      Contains value of SSE "event" field. This field is optional. Method may return null, if the event name is not specified.

      Returns:
      event name, or null if not set.
    • getComment

      String getComment()
      Get a comment string that accompanies the event.

      Contains value of the comment associated with SSE event. This field is optional. Method may return null, if the event comment is not specified.

      Returns:
      comment associated with the event.
    • getReconnectDelay

      long getReconnectDelay()
      Get new connection retry time in milliseconds the event receiver should wait before attempting to reconnect after a connection to the SSE event source is lost.

      Contains value of SSE "retry" field. This field is optional. Method returns RECONNECT_NOT_SET if no value has been set.

      Returns:
      reconnection delay in milliseconds or RECONNECT_NOT_SET if no value has been set.
    • isReconnectDelaySet

      boolean isReconnectDelaySet()
      Check if the connection retry time has been set in the event.
      Returns:
      true if new reconnection delay has been set in the event, false otherwise.