You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: unify url options
* docs: update info
* chore: ensure consistency in the references to WebSocket
* chore: supply runtime config via websocket key
* test: update test suite
* feat: update readme (#18)
* feat: update readme
* chore: update readme title
Co-authored-by: James George <james@deepsource.io>
Co-authored-by: James George <james@deepsource.io>
* chore: update metadaa
* docs: update info
Co-authored-by: Yash Dave <87606277+yash-deepsource@users.noreply.github.com>
Co-authored-by: Shivam Mishra <77610151+shivam-deepsource@users.noreply.github.com>
Co-authored-by: Yash Dave <87606277+yash-deepsource@users.noreply.github.com>
You can pass different options using the `websocket` property in your `nuxt.config.js`:
36
+
You can pass different options using the `websocket` property in your `nuxt.config.js`.
31
37
32
38
```js
33
39
// nuxt.config.js
34
40
exportdefault {
35
41
websocket: {
36
-
// module options
42
+
url:'wss://echo.websocket.events/'
43
+
reconnectInterval:1000
37
44
}
38
45
};
39
46
```
40
47
41
-
### `urlForDev`
42
-
43
-
- Default: `wss://echo.websocket.events/`
44
-
45
-
Defines the websocket URL to connect for local development.
46
-
47
-
### `urlForProd`
48
-
49
-
Defines the websocket URL to connect for production.
50
-
51
-
### `reconnectInterval`
52
-
53
-
- Default: `1000`
54
-
55
-
Defines the time interval after which a reconnection attempt takes place for a close event that isn't normal (code !== 1000). It should be less than 3s.
|`reconnectInterval`| 1000 | The time interval after which a reconnection attempt takes place for a close event. It should be less than 3s. |
56
52
57
53
### Runtime Config
58
54
59
-
URL's for dev and prod supplied via runtime configtakes priority:-
55
+
You can also provide the URL via [runtime config](https://nuxtjs.org/docs/configuration-glossary/configuration-runtime-config/). It always takes precedence over the URL provided via options.
@@ -134,7 +131,7 @@ Closes the WebSocket connection, optionally using code as the the WebSocket conn
134
131
this.$socketManager.close();
135
132
```
136
133
137
-
> The [onmessage](https://github.com/deepsourcelabs/nuxt-websocket/blob/main/src/templates/WebSocketManager.ts#L38-L45) handler expects data received from the server as either a string or an object of the shape `{ event: string, data: string }`.
134
+
> The [message event handler](https://github.com/deepsourcelabs/nuxt-websocket/blob/main/src/templates/WebSocketManager.ts#L39-L46) expects data received from the server as either a string or an object of the shape `{ event: string, data: string }`.
> The [close event handler](https://github.com/deepsourcelabs/nuxt-websocket/blob/main/src/templates/WebSocketManager.ts#L48-L64) attempts reconnection for a close event that is not normal ([connection close code](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code) other than 1000).
0 commit comments