Client SDK API
Reference for the @summoniq/summon-flow client library.
Installation
bun add @summoniq/summon-flow
Constructor
new SummonFlow(appKey: string, options?: ConnectionOptions)
Options
| Option | Type | Default | Description |
|---|---|---|---|
| wsHost | string | realtime.summonflow.com | WebSocket server hostname |
| wsPort | number | 443 | WebSocket port |
| forceTLS | boolean | true | Force TLS connection |
| channelAuthorization | object | — | Auth endpoint config |
| authorizer | function | — | Custom auth function |
| activityTimeout | number | 120 | Seconds before ping |
Methods
subscribe(name)Subscribe to a channel. Returns the Channel instance.
unsubscribe(name)Unsubscribe from a channel.
channel(name)Get an existing channel by name. Returns undefined if not subscribed.
allChannels()Returns an object of all subscribed channels.
connect()Manually open the WebSocket connection.
disconnect()Close the WebSocket connection.
Channel Methods
bind(event, handler)Listen for an event on this channel.
unbind(event, handler?)Remove an event listener.
trigger(event, data)Send a client event (private/presence channels only).
Connection Events
stream.connection.bind('connected', () => {
console.log(stream.connection.socketId);
});
States: initialized, connecting, connected, unavailable, failed, disconnected.
This public SDK is distributed separately from the hosted console and managed web app.