public class ServerSentMessage extends Object
Constructor and Description |
---|
ServerSentMessage(Object data)
Creates a new message.
|
Modifier and Type | Method and Description |
---|---|
Object |
getData()
The data field for the message.
|
String |
getEvent()
A string identifying the type of event described.
|
Object |
getId()
The event ID to set the EventSource object's last event ID value.
|
Long |
getRetry()
The reconnection time to use when attempting to send the event.
|
ServerSentMessage |
setEvent(String event)
Set event type.
|
ServerSentMessage |
setId(Object id)
Set The event ID to set the EventSource object's last event ID value.
|
ServerSentMessage |
setRetry(Long retry)
Set retry option.
|
byte[] |
toByteArray(Context ctx)
Encode message as event source stream format.
|
@Nullable public Object getId()
@Nonnull public ServerSentMessage setId(@Nullable Object id)
id
- Event ID. Converted to String.@Nullable public String getEvent()
@Nonnull public ServerSentMessage setEvent(@Nullable String event)
event
- Event type.@Nonnull public Object getData()
@Nullable public Long getRetry()
@Nonnull public ServerSentMessage setRetry(@Nullable Long retry)
retry
- Retry option.Copyright © 2022. All rights reserved.