Client
Official Client Features
Tag filtering and delta compression workflows that require `@sockudo/client`.
Features That Need @sockudo/client
- Filter-aware subscription API.
- Automatic
pusher:deltadecoding. - Per-subscription delta negotiation.
- Delta stats hooks and error hooks.
Tag Filtering Subscribe API
import Pusher from "@sockudo/client";
import { Filter } from "@sockudo/client/filter";
const pusher = new Pusher("app-key", {
cluster: "mt1",
wsHost: "127.0.0.1",
wsPort: 6001,
forceTLS: false,
});
const channel = pusher.subscribe(
"market-data",
Filter.and(
Filter.eq("event_type", "trade"),
Filter.gte("price", "100")
)
);
Delta Compression (Global Enable)
const pusher = new Pusher("app-key", {
cluster: "mt1",
wsHost: "127.0.0.1",
wsPort: 6001,
forceTLS: false,
deltaCompression: {
enabled: true,
algorithms: ["fossil", "xdelta3"],
debug: false,
onStats: (stats) => console.log(stats.bandwidthSavedPercent),
},
});
Per-Subscription Delta Options
// delta with algorithm
pusher.subscribe("ticker:BTC", {
delta: { enabled: true, algorithm: "fossil" },
});
// filter + delta together
pusher.subscribe("events", {
filter: Filter.eq("priority", "high"),
delta: { algorithm: "xdelta3" },
});
Conflation Key Support
@sockudo/client automatically handles conflation keys when the server enables them. The client:
- Receives
pusher:delta_cache_syncmessages with entity-grouped states - Maintains separate delta histories per conflation key (e.g., per stock symbol, per device ID)
- Reconstructs delta messages using the correct entity's base message
- Tracks cache stats per conflation key when
debug: true
No additional client configuration needed — conflation is configured server-side and the client adapts automatically.
Example server config:
{
"channel_delta_compression": {
"market:*": {
"enabled": true,
"conflation_key": "symbol",
"max_messages_per_key": 100,
"max_conflation_keys": 1000
}
}
}
When you subscribe to market:live, the client will automatically group BTC, ETH, and other symbols' delta states independently.
See Delta Compression for server configuration details.
Plain Pusher Clients
Core channels/events still work on plain pusher-js and Echo.
They just do not expose this advanced API surface out of the box.