Package play.libs
Class EventSource.Event
- Object
-
- play.libs.EventSource.Event
-
- Enclosing class:
- EventSource
public static class EventSource.Event extends Object
Utility class to build events.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventSource.Event
event(com.fasterxml.jackson.databind.JsonNode json)
static EventSource.Event
event(String data)
String
formatted()
EventSource.Event
withId(String id)
EventSource.Event
withName(String name)
-
-
-
Method Detail
-
withName
public EventSource.Event withName(String name)
- Parameters:
name
- Event name- Returns:
- A copy of this event, with name
name
-
withId
public EventSource.Event withId(String id)
- Parameters:
id
- Event id- Returns:
- A copy of this event, with id
id
.
-
formatted
public String formatted()
- Returns:
- This event formatted according to the EventSource protocol.
-
event
public static EventSource.Event event(String data)
- Parameters:
data
- Event content- Returns:
- An event with
data
as content
-
event
public static EventSource.Event event(com.fasterxml.jackson.databind.JsonNode json)
- Parameters:
json
- Json value to use- Returns:
- An event with a string representation of
json
as content
-
-