org.springframework.http.codec

## Class ServerSentEvent<T>

- java.lang.Object
- - org.springframework.http.codec.ServerSentEvent<T>

- Type Parameters:
    `T` - the type of data that this event contains

      public final class ServerSentEvent<T>
      extends Object

  Representation for a Server-Sent Event for use with Spring's reactive Web support. `Flux<ServerSentEvent>` or `Observable<ServerSentEvent>` is the reactive equivalent to Spring MVC's `SseEmitter`.
  Since:
    5.0
  Author:
    Sebastien Deleuze, Arjen Poutsma
  See Also:
    `ServerSentEventHttpMessageWriter`, Server-Sent Events W3C recommendation

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ServerSentEvent.Builder<T>` A mutable builder for a `SseEvent`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> ServerSentEvent.Builder<T>` | `builder()` Return a builder for a `SseEvent`.
    `static <T> ServerSentEvent.Builder<T>` | `builder(T data)` Return a builder for a `SseEvent`, populated with the given data.
    `String` | `comment()` Return the comment of this event, if available.
    `T` | `data()` Return the `data` field of this event, if available.
    `String` | `event()` Return the `event` field of this event, if available.
    `String` | `id()` Return the `id` field of this event, if available.
    `Duration` | `retry()` Return the `retry` field of this event, if available.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### id

          @Nullable
          public String id()

      Return the `id` field of this event, if available.

    - #### event

          @Nullable
          public String event()

      Return the `event` field of this event, if available.

    - #### retry

          @Nullable
          public Duration retry()

      Return the `retry` field of this event, if available.

    - #### comment

          @Nullable
          public String comment()

      Return the comment of this event, if available.

    - #### data

          @Nullable
          public T data()

      Return the `data` field of this event, if available.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### builder

          public static <T> ServerSentEvent.Builder<T> builder()

      Return a builder for a `SseEvent`.
      Type Parameters:
        `T` - the type of data that this event contains
      Returns:
        the builder

    - #### builder

          public static <T> ServerSentEvent.Builder<T> builder(T data)

      Return a builder for a `SseEvent`, populated with the given data.
      Type Parameters:
        `T` - the type of data that this event contains
      Returns:
        the builder