Package play.libs

Class EventSource.Event

java.lang.Object
play.libs.EventSource.Event
Enclosing class:
EventSource

public static class EventSource.Event extends Object
Utility class to build events.
  • Constructor Details

  • Method Details

    • 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