@flexent/protocomm-ws-client
v2.3.0
Published
WebSocket client transport for Protocomm protocols
Downloads
76
Readme
Protocomm WS Client
WebSocket transport client for @flexent/protocomm.
Usage
import { ProtocolIndex } from '@flexent/protocomm';
import { WsClient } from '@flexent/protocomm-ws-client';
class ApiWsClient extends WsClient<MyProtocol> {
protected get url() {
return 'ws://127.0.0.1:8080/ws';
}
protected get protocol() {
return new ProtocolIndex(myProtocol);
}
protected override shouldReconnectOnClose() {
return true;
}
}
const wsClient = new ApiWsClient();
await wsClient.connect();
await wsClient.client.system.ping({});WsClient supports:
- protocol-typed
clientgenerated byRpcClient - mandatory protocol and URL via abstract getters
- overridable defaults for retry/reconnect and socket creation
