Package akka.http.javadsl.model.sse
Class ServerSentEvent
- java.lang.Object
-
- akka.http.javadsl.model.sse.ServerSentEvent
-
- Direct Known Subclasses:
ServerSentEvent
public abstract class ServerSentEvent extends java.lang.Object
Representation of a server-sent event. According to the specification, an empty data field designates an event which is to be ignored which is useful for heartbeats.
-
-
Constructor Summary
Constructors Constructor Description ServerSentEvent()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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.lang.String type)
Creates a [[ServerSentEvent]].static ServerSentEvent
create(java.lang.String data, java.lang.String type, java.lang.String id)
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]].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
-
-
-
Method Detail
-
heartbeat
public static ServerSentEvent heartbeat()
Provides a [[ServerSentEvent]] with empty data which can be used as a heartbeat
-
create
public static ServerSentEvent create(java.lang.String data)
Creates a [[ServerSentEvent]].- Parameters:
data
- data, may be empty or span multiple lines
-
create
public static ServerSentEvent create(java.lang.String data, java.lang.String type)
Creates a [[ServerSentEvent]].- Parameters:
data
- data, may span multiple linestype
- type, must not contain \n or \r
-
create
public static ServerSentEvent create(java.lang.String data, java.lang.String type, java.lang.String id)
Creates a [[ServerSentEvent]].- Parameters:
data
- data, may span multiple linestype
- type, must not contain \n or \rid
- id, must not contain \n or \r
-
create
public static ServerSentEvent create(java.lang.String data, int retry)
Creates a [[ServerSentEvent]].- Parameters:
data
- data, may span multiple linesretry
- reconnection delay in milliseconds
-
create
public 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]].- Parameters:
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 milliseconds
-
getData
public abstract java.lang.String getData()
Data, may span multiple lines.
-
getEventType
public abstract java.util.Optional<java.lang.String> getEventType()
Optional type, must not contain \n or \r.
-
getId
public abstract java.util.Optional<java.lang.String> getId()
Optional id, must not contain \n or \r.
-
getRetry
public abstract java.util.OptionalInt getRetry()
Optional reconnection delay in milliseconds.
-
-