org.springframework.http.codec

Interface ServerSentEvent.Builder<T>

  • Type Parameters:
    T - the type of data that this event contains
    Enclosing class:
    ServerSentEvent<T>


    public static interface ServerSentEvent.Builder<T>
    A mutable builder for a SseEvent.
    • Method Detail

      • id

        ServerSentEvent.Builder<T> id(java.lang.String id)
        Set the value of the id field.
        Parameters:
        id - the value of the id field
        Returns:
        this builder
      • event

        ServerSentEvent.Builder<T> event(java.lang.String event)
        Set the value of the event field.
        Parameters:
        event - the value of the event field
        Returns:
        this builder
      • retry

        ServerSentEvent.Builder<T> retry(java.time.Duration retry)
        Set the value of the retry field.
        Parameters:
        retry - the value of the retry field
        Returns:
        this builder
      • comment

        ServerSentEvent.Builder<T> comment(java.lang.String comment)
        Set SSE comment. If a multi-line comment is provided, it will be turned into multiple SSE comment lines as defined in Server-Sent Events W3C recommendation.
        Parameters:
        comment - the comment to set
        Returns:
        this builder
      • data

        ServerSentEvent.Builder<T> data(@Nullable
                                        T data)
        Set the value of the data field. If the data argument is a multi-line String, it will be turned into multiple data field lines as defined in the Server-Sent Events W3C recommendation. If data is not a String, it will be encoded into JSON.
        Parameters:
        data - the value of the data field
        Returns:
        this builder