WebSocketTransport class

Transport that communicates via WebSocket.

This is the web-safe transport. It connects to a WebSocket bridge server that relays JSON-RPC messages to/from the Copilot CLI.

The bridge server is NOT part of this package; it's a separate concern. The bridge simply:

  1. Accepts WebSocket connections
  2. Spawns or connects to the Copilot CLI
  3. Relays Content-Length framed JSON-RPC messages bidirectionally

Since WebSocket already handles framing, messages over WebSocket are plain JSON strings (no Content-Length framing needed).

Implemented types

Constructors

WebSocketTransport({required Uri uri, Iterable<String>? protocols})

Properties

hashCode int
The hash code for this object.
no setterinherited
isOpen bool
Whether the transport is currently connected/open.
no setteroverride
messages Stream<Map<String, dynamic>>
Stream of incoming JSON-RPC messages (already decoded from JSON).
no setteroverride
protocols Iterable<String>?
WebSocket sub-protocols.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uri Uri
WebSocket URI to connect to (e.g., "ws://localhost:8765").
final

Methods

close() Future<void>
Closes the transport and releases resources.
override
connect() Future<void>
Connects to the WebSocket server.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(Map<String, dynamic> message) Future<void>
Sends a JSON-RPC message (will be encoded to JSON by the transport).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited