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 long RECONNECT_NOT_SET
    A "reconnection not set" value for the SSE reconnect delay set via SSE event retry field.
  • Method Summary

    Modifier and Type Method Description
    String getComment()
    Get a comment string that accompanies the event.
    String getId()
    Get event identifier.
    String getName()
    Get event name.
    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.
    boolean isReconnectDelaySet()
    Check if the connection retry time has been set in the event.
  • Field Details

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