Skip to content

Commit

Permalink
docs: fix createWebsocket example
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 25, 2024
1 parent 56e6e23 commit b49742e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,18 @@ through a proxy with custom authentication this callback allows you to create yo
instance of a websocket which will be used in the mqtt client.

```js
const createWebsocket = createWebsocket(url, websocketSubProtocols, options) => {
const createWebsocket = (url, websocketSubProtocols, options) => {
const subProtocols = [
websocketSubProtocols[0],
'myCustomSubprotocolOrOAuthToken',
]
return new WebSocket(url, subProtocols)
}

const connection = await mqtt.connectAsync(<wss url>, {
...,
createWebsocket: createWebsocket,
});
const client = await mqtt.connectAsync(<wss url>, {
...,
createWebsocket: createWebsocket,
});
```

#### Enabling Reconnection with `reconnectPeriod` option
Expand Down

0 comments on commit b49742e

Please sign in to comment.