rpc_dart_websocket
WebSocket caller/responder transports for rpc_dart, web-safe (dart2js and
Wasm) as well as VM.
RpcWebSocketCallerTransport— client transport;connect()awaitsWebSocketChannel.ready, andreconnect()re-attaches to a fresh socket while keepingincomingMessagesstable across the swap.RpcWebSocketResponderTransport— server-side transport for one accepted connection.RpcWebSocketServer— anIRpcServerthat accepts connections and wires an endpoint per client.RpcWebSocketChannel— the rawIRpcChannelbyte pipe, if you want to build the stack yourself viaRpcChannelTransport.fromChannel.
Multiplexing uses the core 9-byte channel frame (stream id + flags + length), so all four call kinds share one socket.
Usage
import 'package:rpc_dart_websocket/rpc_dart_websocket.dart';
final transport = await RpcWebSocketCallerTransport.connect(
Uri.parse('ws://localhost:8080'),
);
final caller = RpcCallerEndpoint(transport: transport);
Unlike rpc_dart_http2, this is not the gRPC wire protocol — it is the
rpc_dart frame protocol over WebSocket, so both peers must be rpc_dart.
Libraries
- rpc_dart_websocket
- Web-safe WebSocket transport for rpc_dart.