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.Eventevent(com.fasterxml.jackson.databind.JsonNode json)static EventSource.Eventevent(String data)Stringformatted()EventSource.EventwithId(String id)EventSource.EventwithName(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
dataas 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
jsonas content
-
-