Class JdkWebSocketTransport
java.lang.Object
org.cloudburstmc.netty.signaling.control.JdkWebSocketTransport
- All Implemented Interfaces:
AutoCloseable
One bounded text WebSocket connection. Authentication, endpoint trust, application acknowledgments,
reconnect and session authority belong to the caller. A successful send means local send completion,
not acknowledgment that the remote application received or accepted the message.
The client, executor and scheduler are borrowed and must outlive this connection; none is shut down here.
The receiver executor must dispatch asynchronously and its handler must return promptly. Only one
complete message is delivered at a time, and the next receive is requested after its stage completes.
Cancelling a returned stage does not cancel the connection; use
abort() to do that.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordLimits apply to UTF-8 bytes, pending sends including the active send, and JDK receive callbacks. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidclose()Initiates bounded graceful closure without blocking the calling thread.closed()Completes on peer close; errors, abort and timeout complete exceptionally.Drains accepted sends then sends normal closure, with a deadline covering the entire drain.static JdkWebSocketTransportconnect(HttpClient client, URI endpoint, String subprotocol, Map<String, String> headers, JdkWebSocketTransport.Limits limits, Executor receiverExecutor, ScheduledExecutorService scheduler, Function<String, ? extends CompletionStage<?>> receiver) Starts an asynchronous upgrade.opened()Sends one complete immutable message, failing immediately when capacity is exhausted.Carries the original nonblocking authority guard through the bounded send queue.
-
Method Details
-
connect
public static JdkWebSocketTransport connect(HttpClient client, URI endpoint, String subprotocol, Map<String, String> headers, JdkWebSocketTransport.Limits limits, Executor receiverExecutor, ScheduledExecutorService scheduler, Function<String, ? extends CompletionStage<?>> receiver) Starts an asynchronous upgrade. Production callers must supply a trusted WSS endpoint and normal TLS verification. Plain WS is supported for local transports/tests, never selected as a fallback. An empty subprotocol requests none; otherwise the server must select exactly the requested value. -
opened
-
closed
Completes on peer close; errors, abort and timeout complete exceptionally. -
sendText
Sends one complete immutable message, failing immediately when capacity is exhausted. -
sendText
Carries the original nonblocking authority guard through the bounded send queue. -
closeGracefully
Drains accepted sends then sends normal closure, with a deadline covering the entire drain. -
close
public void close()Initiates bounded graceful closure without blocking the calling thread.- Specified by:
closein interfaceAutoCloseable
-
abort
public void abort()
-