Changelog
1.0.0
Initial release.
Core
Transportinterface withrequest(),subscribe(),connect(),close()- Spread-style parameters —
request('method', param1, param2)instead of array wrapping - Schema-based generics for type-safe method names, parameters, and return types
BatchSchedulerfor automatic request batching with configurable batch size and wait timewithRetry()utility with exponential backoffparse()for creating transports from URL strings (supports nested meta-transports and query-string options)createParse()for building custom parse functions with overridden package mapscreateParseSync()for building synchronous parse functions using pre-imported factory functionsElectrumCashSchematype definitions (protocol v1.5 and v1.6)EthereumSchematype definitions (EIP-1474 standard methods)
Transports
- WebSocket — Full-duplex communication with subscriptions, keep-alive, reconnection, connection pooling
- TCP — Newline-delimited JSON-RPC with TLS support, keep-alive, reconnection (Node.js)
- HTTP — Stateless JSON-RPC over HTTP POST with custom headers, fetch options, and raw mode
All transports support lazy connections — no resources are allocated until the first request(), subscribe(), or connect() call.
Meta-Transports
- Fallback — Automatic failover across multiple transports with optional health-based ranking
- Default
shouldThrowstops fallback on deterministic JSON-RPC errors (parse error, invalid request, invalid params) eagerConnectprioritizes the fastest-connecting transportonScoreslistener andscoresproperty for monitoring transport healthonResponsehook for observing requests across all transports
- Default
- Cluster — m-of-n quorum consensus with deep-equality response matching
onResponsehook for observing individual transport responses
- Single-element passthrough —
fallback([t])andcluster([t])return the input transport directly
Electrum Cash Variants
Protocol-specific subpath imports (@rpckit/*/electrum-cash) with pre-configured defaults:
server.versionhandshake with configurableclientNameandprotocolVersionserver.pingkeep-alivesubscribe/unsubscribemethod conventionserver.versionHTTP header- Fallback variant with
server.pinghealth probing and protocol-awareshouldThrow(retries transient server errors like OOM, warmup, syncing)
Ethereum Variants
Protocol-specific subpath imports (@rpckit/*/ethereum) for Ethereum JSON-RPC:
eth_subscriptionnotification routing by subscription IDeth_unsubscribecalled automatically on cleanup- Subscription ID suppressed from callbacks (handled internally)
- Custom
parse()function for Ethereum transports
Features
- Automatic request batching with configurable batch size and wait time
- Subscription support with automatic resubscription on reconnect
- Handshake re-execution on reconnect (WebSocket and TCP)
- Connection pooling with ref counting for WebSocket and TCP transports
- Retry with exponential backoff on all transports
- Raw mode for HTTP transport (return full JSON-RPC envelopes instead of throwing on error)
- Request/response hooks on HTTP transport
- Socket access via
getSocket()andgetSocketAsync()on WebSocket and TCP transports - Subscription sharing — multiple listeners on the same method+params share one server subscription
- Smart unsubscribe — server unsubscribe only sent when last listener removes
- Fresh data for new subscribers — new listeners receive most recent notification, not stale initial result
- Race condition prevention — concurrent subscription calls safely coalesce
notificationFiltercallback for protocol-specific notification routingtransformInitialResultoption to normalize or suppress initial subscription results- HTTP transport includes response body in error messages for better debugging