Class WebSocketTransport
java.lang.Object
ai.badmonkey.agentspaces.transport.http.WebSocketTransport
- All Implemented Interfaces:
Transport, AutoCloseable
The
ws binding (SRAD agentspaces-js §3.3; ISSUE-Websocket FR-1): one
binary WebSocket message per frame over plain TCP, subprotocol
aspace.1, path /aspace by default. The WebSocket analogue of
tcp: for development, tests, and links behind a TLS terminator
inside a trusted network; it attests nothing, so peers in the SESSION mode
attest the connection in band (SPEC §5.6), and a node that requires
attestation refuses it.-
Nested Class Summary
Nested classes/interfaces inherited from interface Transport
Transport.Capability -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintThe port a listener bound, for a bind address with port 0 (tests).Reports what this binding provides.voidclose()Closes every listener and connection this binding opened; idempotent.final HttpCounterscounters()The binding's counters (JS-H-12).Opens a connection to a peer address.listen(String bindAddress, Consumer<TransportConnection> onAccept) Starts listening for inbound connections.final HttpOptionsoptions()The binding's options.options(HttpOptions options) Sets the options; valid before the first dial or listen.scheme()Returns the transport scheme, e.g.
-
Field Details
-
SCHEME
-
SUBPROTOCOL
The subprotocol both ends negotiate (FR-5): the binding version in token syntax.- See Also:
-
-
Constructor Details
-
WebSocketTransport
public WebSocketTransport()
-
-
Method Details
-
options
Sets the options; valid before the first dial or listen. -
scheme
-
capabilities
Description copied from interface:TransportReports what this binding provides. The default is the reliable, ordered, unencrypted, non-attesting posture every binding has at least; bindings that encrypt or attest override it.- Returns:
- the capabilities, never empty
-
listen
public AutoCloseable listen(String bindAddress, Consumer<TransportConnection> onAccept) throws IOException Description copied from interface:TransportStarts listening for inbound connections.- Parameters:
bindAddress- a transport-specific bind addressonAccept- invoked for each accepted connection- Returns:
- a handle that stops listening when closed
- Throws:
IOException- if the address cannot be bound
-
boundPort
The port a listener bound, for a bind address with port 0 (tests). -
dial
Description copied from interface:TransportOpens a connection to a peer address.- Parameters:
address- a transport-specific address- Returns:
- the open connection
- Throws:
IOException- if the peer cannot be reached
-
options
The binding's options. -
counters
The binding's counters (JS-H-12). -
close
public void close()Closes every listener and connection this binding opened; idempotent.- Specified by:
closein interfaceAutoCloseable
-