rpc_dart_websocket 0.2.3 copy "rpc_dart_websocket: ^0.2.3" to clipboard
rpc_dart_websocket: ^0.2.3 copied to clipboard

Web-safe subset of rpc_dart_transports providing WebSocket caller/responder transports (caller + server) for Dart2JS/WASM builds.

rpc_dart_websocket #

WebSocket caller/responder transports for rpc_dart, web-safe (dart2js and Wasm) as well as VM.

  • RpcWebSocketCallerTransport — client transport; connect() awaits WebSocketChannel.ready, and reconnect() re-attaches to a fresh socket while keeping incomingMessages stable across the swap.
  • RpcWebSocketResponderTransport — server-side transport for one accepted connection.
  • RpcWebSocketServer — an IRpcServer that accepts connections and wires an endpoint per client.
  • RpcWebSocketChannel — the raw IRpcChannel byte pipe, if you want to build the stack yourself via RpcChannelTransport.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.

0
likes
130
points
43
downloads

Documentation

API reference

Publisher

verified publisherrpc.nogipx.dev

Weekly Downloads

Web-safe subset of rpc_dart_transports providing WebSocket caller/responder transports (caller + server) for Dart2JS/WASM builds.

Homepage
Repository (GitHub)
View/report issues

Topics

#rpc #websocket

License

MIT (license)

Dependencies

rpc_dart, web_socket_channel

More

Packages that depend on rpc_dart_websocket