Class HandshakeResult.Accepted.Builder
java.lang.Object
com.soklet.HandshakeResult.Accepted.Builder
- Enclosing class:
HandshakeResult.Accepted
Builder used to construct instances of
HandshakeResult.Accepted.
This class is intended for use by a single thread.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()clientInitializer(Consumer<ServerSentEventUnicaster> clientInitializer) Specifies custom "client initializer" function to run immediately after the handshake succeeds - useful for performing "catch-up" logic if the client had provided aLast-Event-IDrequest header.cookies(Set<ResponseCookie> cookies) Specifies custom response cookies to be sent with the handshake.Specifies custom response headers to be sent with the handshake.
-
Method Details
-
headers
-
cookies
Specifies custom response cookies to be sent with the handshake.- Parameters:
cookies- custom response cookies to send- Returns:
- this builder, for chaining
-
clientInitializer
@Nonnull public HandshakeResult.Accepted.Builder clientInitializer(@Nullable Consumer<ServerSentEventUnicaster> clientInitializer) Specifies custom "client initializer" function to run immediately after the handshake succeeds - useful for performing "catch-up" logic if the client had provided aLast-Event-IDrequest header.The function is provided with a
ServerSentEventUnicaster, which permits sending Server-Sent Events and comments directly to the client that accepted the handshake (as opposed to aServerSentEventBroadcaster, which would send to all clients listening on the sameResourcePath).Full documentation is available at https://www.soklet.com/docs/server-sent-events.
- Parameters:
clientInitializer- custom function to run to initialize the client- Returns:
- this builder, for chaining
-
build
-