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 per-connection 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. -
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.Per-connection clients are 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
-
-
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
-