@h3channels/sdk
v0.1.0
Published
H3Channels client SDK for browser and Node.js
Maintainers
Readme
@h3channels/sdk
H3Channels client SDK for browser and Node.js.
Installation
pnpm add @h3channels/sdk
# or
npm install @h3channels/sdkUsage
See the main README for usage examples.
API
connect(options)
Creates and connects a new H3Channels client.
H3ChannelsClient
subscribe(channel, options)- Subscribe to a channelpublish(channel, data, options)- Publish a messagedisconnect()- Disconnect from the serveron(event, callback)- Listen to connection state changesoff(event, callback)- Remove event listener
Subscription
onMessage(callback)- Register message handlerunsubscribe()- Unsubscribe from channel
Transport Modes
- WebTransport: Used in browsers when available (Chrome 97+, Edge 97+)
- WebSocket: Fallback transport, used in Node.js and when WebTransport is unavailable
Message Delivery Modes
- DATAGRAM: Fast, unreliable delivery. Client automatically drops stale messages based on sequence numbers.
- RELIABLE_STREAM: Guaranteed ordered delivery for critical messages.
