jooby/src/main/java/org/jooby/Sse.java
@Nonnull
  public CompletableFuture<Optional<Object>> send(final Object data, final MediaType type) {
    return event(data).type(type).send();
  }
@Nonnull
  public CompletableFuture<Optional<Object>> send(final Object data, final MediaType type) {
    return event(data).type(type).send();
  }
@ Nonnull public CompletableFuture < Optional < Object > > send ( final Object data , final MediaType type ) { return event ( data ) . type ( type ) . send ( ) ; }
Send an event and set media type.

<pre>{@code
sse.send(new MyObject(), "json");
}</pre>

<pre>{@code
sse.send(new MyObject(), "json").whenComplete((id, x) -> {
if (x == null) {
handleSuccess();
} else {
handleError(x);
}
});
}</pre>

The <code>id</code> of the success callback correspond to the {@link Event#id()}.

@param data Event data.
@param type Media type, like: json, xml.
@return A future. The success callback contains the {@link Event#id()}.
Send an event and set media type .