Package one.nio.http
Interface EventSource<D>
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
EventSourceResponse,HttpClient.ServerSentEventsReader
public interface EventSource<D> extends java.io.CloseableA source of server side emitted events
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceEventSource.Event<D>A single Server Sent Event, received from peer.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EventSource.Event<D>poll()Waits for the next SSE and returns an event.
-
-
-
Method Detail
-
poll
EventSource.Event<D> poll() throws java.io.IOException, HttpException
Waits for the next SSE and returns an event. The method can block for a long time ( determined by server ). It is essential to check for null andEventSource.Event.isEmpty()before processing- Returns:
- the next event from the stream or null, if stream was closed by either party
- Throws:
java.io.IOException- an I/O exception occurredHttpException- an incorrect HTTP request received
-
-