Class JdkWebsocketConnector
java.lang.Object
io.fluxzero.sdk.common.websocket.JdkWebsocketConnector
- All Implemented Interfaces:
WebsocketConnector
Low-level Fluxzero websocket connector backed by the JDK
HttpClient websocket implementation.
The JDK WebSocket API does not expose successful 101 Switching Protocols response headers directly.
This connector captures them through a shared CookieHandler wrapper while preserving any cookie handler
configured on the supplied HttpClient.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a connector backed by a default HTTP/1.1HttpClient.JdkWebsocketConnector(HttpClient httpClient) Creates a connector backed by the supplied HTTP client.JdkWebsocketConnector(HttpClient httpClient, Executor executor) Creates a connector backed by the supplied HTTP client and executor. -
Method Summary
Modifier and TypeMethodDescriptionconnect(WebsocketEndpoint endpoint, WebsocketConnectionOptions options, URI uri) Opens a native JDK WebSocket and adapts it to Fluxzero's low-levelWebsocketSessioncontract.
-
Constructor Details
-
JdkWebsocketConnector
public JdkWebsocketConnector()Creates a connector backed by a default HTTP/1.1HttpClient. -
JdkWebsocketConnector
Creates a connector backed by the supplied HTTP client.A single internal client is derived from this client so the connector can install its handshake-header capturing cookie handler without mutating the original client.
- Parameters:
httpClient- base client whose proxy, SSL, authenticator, executor, cookie, and timeout settings are reused
-
JdkWebsocketConnector
Creates a connector backed by the supplied HTTP client and executor.The executor is used for the internal HTTP client derived from the supplied client and for dispatching native JDK websocket listener callbacks.
- Parameters:
httpClient- base client whose proxy, SSL, authenticator, cookie, and timeout settings are reusedexecutor- executor for JDK websocket and listener callback work
-
-
Method Details
-
connect
public WebsocketSession connect(WebsocketEndpoint endpoint, WebsocketConnectionOptions options, URI uri) throws IOException Opens a native JDK WebSocket and adapts it to Fluxzero's low-levelWebsocketSessioncontract.- Specified by:
connectin interfaceWebsocketConnector- Parameters:
endpoint- endpoint callbacks for the new sessionoptions- connection options; implementations may acceptnullas default optionsuri- target WebSocket URI- Returns:
- an open WebSocket session
- Throws:
IOException
-