Interface ServerSentEventConnection
public interface ServerSentEventConnection
Represents characteristics of a long-running connection that has been established with a
ServerSentEventServer.
Instances are exposed via LifecycleObserver, which enables you to monitor events that occur on the connection over time (established, SSE payload written, terminated, etc.)
See https://www.soklet.com/docs/server-sent-events for general Server-Sent Event documentation and https://www.soklet.com/docs/request-lifecycle#server-sent-events for lifecycle-specific documentation.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumCategorizes why a Server-Sent Event handshake failed.static enumCategorizes why a Server-Sent Event connection terminated. -
Method Summary
Modifier and TypeMethodDescriptionReturns the connection-specific context as provided by an accepted handshake.Returns the moment at which this connection was established.The request made by the client to the Event Source Method which accepted the SSE handshake and established the connection.Returns the Event Source Method that provided the accepted handshake for this connection.
-
Method Details
-
getRequest
The request made by the client to the Event Source Method which accepted the SSE handshake and established the connection.- Returns:
- the request made by the client to the Event Source Method
-
getResourceMethod
Returns the Event Source Method that provided the accepted handshake for this connection.- Returns:
- the Event Source Method that provided the accepted handshake for this connection
-
getEstablishedAt
Returns the moment at which this connection was established.- Returns:
- the moment at which this connection was established.
-
getClientContext
Returns the connection-specific context as provided by an accepted handshake.This will always be the value returned by
HandshakeResult.Accepted.getClientContext().- Returns:
- the connection-specific context, or
Optional.empty()if none was specified
-