Package io.micronaut.http.sse
Interface Event<T>
- Type Parameters:
T
- The event type
public interface Event<T>
Represents a Server Sent Event. See https://www.w3.org/TR/2011/WD-eventsource-20111020/.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets the event comment.getData()
getId()
getName()
getRetry()
Sets the id.Sets the event name.static <ET> Event<ET>
of
(ET data) Constructs a new event for the given data.static <ET> Event<ET>
Constructs a new event for the given data.Sets the retry duration.
-
Field Details
-
ID
The id parameter.- See Also:
-
EVENT
The event parameter.- See Also:
-
DATA
The data parameter.- See Also:
-
RETRY
The retry parameter.- See Also:
-
-
Method Details
-
getData
T getData()- Returns:
- The data object to write
-
getId
String getId()- Returns:
- The ID of the event, or null if there is no ID
-
getName
String getName()- Returns:
- The name of the event
-
getComment
String getComment()- Returns:
- A comment for the event, or null if there is no comment
-
getRetry
Duration getRetry()- Returns:
- The duration to retry
-
retry
Sets the retry duration.- Parameters:
duration
- The duration- Returns:
- The event
-
id
Sets the id.- Parameters:
id
- The id to set- Returns:
- The event
-
name
Sets the event name.- Parameters:
name
- The event name- Returns:
- The event
-
comment
Sets the event comment.- Parameters:
comment
- The Event comment- Returns:
- The event
-
of
Constructs a new event for the given data.- Type Parameters:
ET
- The data type- Parameters:
data
- The data- Returns:
- The event instance
-
of
Constructs a new event for the given data.- Type Parameters:
ET
- The data type- Parameters:
event
- The eventdata
- The data- Returns:
- The event instance
-