Skip to content

Commit

Permalink
docs: add note about dynamic namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Nov 13, 2021
1 parent e0544b5 commit 792ca5a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/categories/06-Advanced/namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,21 @@ const parentNamespace = io.of(/^\/dynamic-\d+$/);
parentNamespace.emit("hello"); // will be sent to users in /dynamic-1, /dynamic-2, ...
```

:::caution

Existing namespaces have priority over dynamic namespaces. For example:

```js
// register "dynamic-101" namespace
io.of("/dynamic-101");

io.of(/^\/dynamic-\d+$/).on("connection", (socket) => {
// will not be called for a connection on the "dynamic-101" namespace
});
```

:::

## Complete API

The complete API exposed by the Namespace instance can be found [here](../../server-api.md#namespace).

1 comment on commit 792ca5a

@vercel
Copy link

@vercel vercel bot commented on 792ca5a Nov 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.