Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Filters

Filters run in the SDK, on the client. They are not a server plugin.

Put the same filter list on sender and receiver for the same tenant + channel prefix. Outbound filters run in reverse registration order. Inbound filters run in registration order.

JavaScript

import { CompressedFilter, open } from "@fastpubsub-sdk/client";

const client = await session.webSocket(accessToken)
  .addFilter("app", "public.chat.", new CompressedFilter())
  .build();

Smaller imports:

import { CompressedFilter } from "@fastpubsub-sdk/client/filters/compressed";

Larger than one overlay message (~64 KB): put FragmentFilter on both ends of the same prefix.

import { FragmentFilter } from "@fastpubsub-sdk/client";

const client = await session.webSocket(accessToken)
  .addFilter("app", "files.", new FragmentFilter(64 * 1024, 16 * 1024))
  .build();

Common filters

FilterUse it for
Compression (CompressedFilter)Text/JSON with repetition. Skip already compressed media.
Encryption (EncryptionFilter)Application payload encryption (ChaCha20-Poly1305 by default, AES-GCM available). This is not a substitute for TLS.
Fragmentation (FragmentFilter)Application payloads larger than one overlay message (~64 KB). Splits on send and reassembles on receive. Both ends need the same filter. Fragments are still best-effort.
DeltaIncremental state after a snapshot (radio metadata is this pattern).
Latest-onlyGame/UI loops that only need the newest value.
BatchMany small messages on one channel.
Send-rate / bandwidthCap how fast the client sends. Token KB/s caps are a separate server-side limit.

Use a wide prefix (public.) only when every child channel should share the filter. Prefer public.chat. when only chat needs it.

Encryption keys

Both sides must share key material out of band. FastPubSub does not distribute application keys. The Video Meeting demo does not encrypt media yet.

Token bandwidth vs filters

  • SDK bandwidth / send-rate filters shape what the client attempts to send.
  • Token ingress_kb_per_sec / egress_kb_per_sec are enforced at the edge.

You can use both. Tenant-wide abuse limits are still a separate roadmap item.