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
feat: add unixSocket option and +unix suffix support to protocol (#1874)
* fix: consider path when protocol is ws/wss
* fix: add test
* feat: add `unixSocket` option and `+unix` suffix support to protocol
* fix: readme
* fix: minor refactor
* fix: validate protocol only when parsing url
* fix: use object.assign
* fix: edge cases
* style: add comments
Copy file name to clipboardExpand all lines: README.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,6 @@ Hello mqtt
124
124
125
125
MQTT.js can be used in React Native applications. To use it, see the [React Native example](https://github.com/MaximoLiberata/react-native-mqtt.js-example)
126
126
127
-
128
127
If you want to run your own MQTT broker, you can use
129
128
[Mosquitto](http://mosquitto.org) or
130
129
[Aedes-cli](https://github.com/moscajs/aedes-cli), and launch it.
@@ -354,7 +353,9 @@ Connects to the broker specified by the given url and options and
354
353
returns a [Client](#client).
355
354
356
355
The URL can be on the following protocols: 'mqtt', 'mqtts', 'tcp',
357
-
'tls', 'ws', 'wss', 'wxs', 'alis'. The URL can also be an object as returned by
356
+
'tls', 'ws', 'wss', 'wxs', 'alis'. If you are trying to connect to a unix socket just append the `+unix` suffix to the protocol (ex: `mqtt+unix`). This will set the `unixSocket` property automatically.
- `manualConnect`: prevents the constructor to call `connect`. In this case after the `mqtt.connect` is called you should call `client.connect` manually.
468
469
- `timerVariant`: defaults to `auto`, which tries to determine which timer is most appropriate for you environment, if you're having detection issues, you can set it to `worker` or `native`
470
+
- `unixSocket`: if you want to connect to a unix socket, set this to true
469
471
470
472
In case mqtts (mqtt over tls) is required, the `options` object is passed through to [`tls.connect()`](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback). If using a **self-signed certificate**, set `rejectUnauthorized: false`. However, be cautious as this exposes you to potential man in the middle attacks and isn't recommended for production.
0 commit comments