Package io.karatelabs.http
Interface SseHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handler for Server-Sent Events (SSE) connections.
Called when a client sends a request with "Accept: text/event-stream".
The handler receives the request and an open SSE connection to send events on.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(HttpRequest request, SseConnection connection) Handle an SSE connection.
-
Method Details
-
accept
Handle an SSE connection. This method is called on a Netty worker thread. Implementations should typically hand off to a background thread for long-running event streams and return promptly.- Parameters:
request- the HTTP request that initiated the SSE connectionconnection- the SSE connection to send events on
-