Package com.linecorp.armeria.common.sse
Interface ServerSentEvent
public interface ServerSentEvent
An interface for the Server-Sent Events specification.
If a
Publisher
or Stream
produces objects which implement this interface, it can be
converted into a text event stream by ServerSentEventResponseConverterFunction
.-
Method Summary
Modifier and Type Method Description static ServerSentEventBuilder
builder()
Returns a newly createdServerSentEventBuilder
.String
comment()
Returns a comment of this event, if it exists.String
data()
Returns a data of this event, if it exists.static ServerSentEvent
empty()
Returns a singleton emptyServerSentEvent
.String
event()
Returns an event name of this event, if it exists.String
id()
Returns an ID of this event, if it exists.static ServerSentEvent
ofComment(String comment)
Creates a newServerSentEvent
with the specifiedcomment
.static ServerSentEvent
ofData(String data)
Creates a newServerSentEvent
with the specifieddata
.static ServerSentEvent
ofEvent(String event)
Creates a newServerSentEvent
with the specifiedevent
.static ServerSentEvent
ofId(String id)
Creates a newServerSentEvent
with the specifiedid
.static ServerSentEvent
ofRetry(Duration retry)
Creates a newServerSentEvent
with the specifiedretry
.Duration
retry()
Returns a reconnection time in milliseconds, if it exists.
-
Method Details
-
empty
Returns a singleton emptyServerSentEvent
. -
ofId
Creates a newServerSentEvent
with the specifiedid
. -
ofEvent
Creates a newServerSentEvent
with the specifiedevent
. -
ofRetry
Creates a newServerSentEvent
with the specifiedretry
. -
ofComment
Creates a newServerSentEvent
with the specifiedcomment
. -
ofData
Creates a newServerSentEvent
with the specifieddata
. -
builder
Returns a newly createdServerSentEventBuilder
. -
id
Returns an ID of this event, if it exists. Otherwise,null
will be returned. -
event
Returns an event name of this event, if it exists. Otherwise,null
will be returned. -
retry
Returns a reconnection time in milliseconds, if it exists. Otherwise,null
will be returned. -
comment
Returns a comment of this event, if it exists. Otherwise,null
will be returned. -
data
Returns a data of this event, if it exists. Otherwise,null
will be returned.
-