Skip to content

Commit abf38c0

Browse files
committed
docs: configuration
1 parent 8f7bcaa commit abf38c0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Configuration
3+
description: Configure the Nuxt WebSocket module.
4+
navigation.icon: i-lucide-bolt
5+
---
6+
7+
There are only a few options to configure the Nuxt WebSocket module. They are all optional and you can set these options in your `nuxt.config.ts` file.
8+
9+
A complete example would look like this:
10+
11+
```ts [nuxt.config.ts]
12+
export default defineNuxtConfig({
13+
modules: ['nuxt-ws'],
14+
15+
ws: {
16+
path: '/_ws',
17+
topics: {
18+
defaults: ['session'],
19+
internals: ['_internal', 'notifications'],
20+
},
21+
}
22+
})
23+
```
24+
25+
## Options
26+
27+
::field-group
28+
::field{name="path" type="string"}
29+
Defines the default path for `useWS` to connect to the WebSocket server. - Default to `undefined`
30+
::
31+
32+
::field{name="topics.defaults" type="string[]"}
33+
Defines the topics that are automatically subscribed to when a connection is established. - Default to `[]`
34+
::
35+
36+
::field{name="topics.internals" type="string[]"}
37+
Defines the topics that are considered internal and can only be listened to by the clients. Interactions with these are only possible via `hooks` - Default to `[]`
38+
::
39+
::

0 commit comments

Comments
 (0)