Interface ReactiveRoutes.ServerSentEvent<T>

  • Type Parameters:
    T - the type of payload, use for the data section of the event.
    Enclosing class:
    ReactiveRoutes

    public static interface ReactiveRoutes.ServerSentEvent<T>
    A class allowing to customized how the server sent events are written.

    The data section of the resulting event is the JSON representation of the result from data(). If event() does not return null, the event section is written with the result as value. If id() is implemented, the id section uses this value.

    • Method Detail

      • event

        default String event()
        The event section.
        Returns:
        the name of the event. If null, the written event won't have an event section
      • data

        T data()
        The data section.
        Returns:
        the object that will be encoded to JSON. Must not be null
      • id

        default long id()
        The id section. If not implemented, an automatic id is inserted.
        Returns:
        the id