public abstract class ServerSentEvent
extends java.lang.Object
Constructor and Description |
---|
ServerSentEvent() |
Modifier and Type | Method and Description |
---|---|
static ServerSentEvent |
create(java.lang.String data)
Creates a [[ServerSentEvent]].
|
static ServerSentEvent |
create(java.lang.String data,
int retry)
Creates a [[ServerSentEvent]].
|
static ServerSentEvent |
create(java.lang.String data,
java.util.Optional<java.lang.String> type,
java.util.Optional<java.lang.String> id,
java.util.OptionalInt retry)
Creates a [[ServerSentEvent]].
|
static ServerSentEvent |
create(java.lang.String data,
java.lang.String type)
Creates a [[ServerSentEvent]].
|
static ServerSentEvent |
create(java.lang.String data,
java.lang.String type,
java.lang.String id)
Creates a [[ServerSentEvent]].
|
abstract java.lang.String |
getData()
Data, may span multiple lines.
|
abstract java.util.Optional<java.lang.String> |
getEventType()
Optional type, must not contain \n or \r.
|
abstract java.util.Optional<java.lang.String> |
getId()
Optional id, must not contain \n or \r.
|
abstract java.util.OptionalInt |
getRetry()
Optional reconnection delay in milliseconds.
|
static ServerSentEvent |
heartbeat()
Provides a [[ServerSentEvent]] with empty data which can be used as a heartbeat
|
public static ServerSentEvent heartbeat()
public static ServerSentEvent create(java.lang.String data)
data
- data, may be empty or span multiple linespublic static ServerSentEvent create(java.lang.String data, java.lang.String type)
data
- data, may span multiple linestype
- type, must not contain \n or \rpublic static ServerSentEvent create(java.lang.String data, java.lang.String type, java.lang.String id)
data
- data, may span multiple linestype
- type, must not contain \n or \rid
- id, must not contain \n or \rpublic static ServerSentEvent create(java.lang.String data, int retry)
data
- data, may span multiple linesretry
- reconnection delay in millisecondspublic static ServerSentEvent create(java.lang.String data, java.util.Optional<java.lang.String> type, java.util.Optional<java.lang.String> id, java.util.OptionalInt retry)
data
- data, may span multiple linestype
- optional type, must not contain \n or \rid
- optional id, must not contain \n or \rretry
- optional reconnection delay in millisecondspublic abstract java.lang.String getData()
public abstract java.util.Optional<java.lang.String> getEventType()
public abstract java.util.Optional<java.lang.String> getId()
public abstract java.util.OptionalInt getRetry()