> For the complete documentation index, see [llms.txt](https://zumo.fusion.ac/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zumo.fusion.ac/documentation/guides/mode-filtering.md).

# Mode filtering

Pass `query: { mode: '<gametype>' }` at connect time to receive only events whose envelope `mode` matches. Omit the query to receive every mode your key is allowed to see.

```js
const socket = io(HUB_URL, {
  auth: { key: KEY },
  query: { mode: 'duels' },
});
```

{% hint style="danger" %}
**`replayFinished` quirk:** that event sets `mode` to the **in-replay game mode** (for example `"4v4"`), not `"replay"`. A connection filtered with `mode: 'replay'` will **not** receive `replayFinished`.
{% endhint %}

## Recommendations

* Lobby-only clients: filter by game mode (`duels`, `bedwars`, …)
* Replay completion listeners: **omit** the mode filter (or use a second connection without it)
* Do not assume all replay lifecycle events share the same `mode` value

See [replayFinished](https://app.gitbook.com/s/M9ty6FYa3j98VSBHF9LN/ws/replay/replay-finished).
