object EventSource
Ordering
- Alphabetic
- By Inheritance
Inherited
- EventSource
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Type Members
- case class Event(data: String, id: Option[String], name: Option[String]) extends Product with Serializable
An event encoded with the SSE protocol..
- case class EventDataExtractor[A](eventData: (A) => String) extends Product with Serializable
- case class EventIdExtractor[E](eventId: (E) => Option[String]) extends Product with Serializable
- case class EventNameExtractor[E](eventName: (E) => Option[String]) extends Product with Serializable
- trait LowPriorityEventEncoder extends AnyRef
- trait LowPriorityEventIdExtractor extends AnyRef
- trait LowPriorityEventNameExtractor extends AnyRef
Value Members
- def flow[E](implicit arg0: EventDataExtractor[E], arg1: EventNameExtractor[E], arg2: EventIdExtractor[E]): Flow[E, Event, _]
Makes a
Flow[E, Event, _]
, given an input source.Makes a
Flow[E, Event, _]
, given an input source.Usage example:
val jsonStream: Source[JsValue, Unit] = createJsonSource() Ok.chunked(jsonStream via EventSource.flow).as(ContentTypes.EVENT_STREAM)
- object Event extends Serializable
- object EventDataExtractor extends with Serializable
- object EventIdExtractor extends with Serializable
- object EventNameExtractor extends with Serializable
This class provides an easy way to use Server Sent Events (SSE) as a chunked encoding, using an Pekko Source.
Please see the Server-Sent Events specification for details.
An example of how to display an event stream: