Skip to content

Commit

Permalink
Merge pull request #86 from kaandesu/fix/wss-attempt
Browse files Browse the repository at this point in the history
fix: no wss attempt when useSSL is false
  • Loading branch information
kaandesu authored Jun 27, 2024
2 parents a73f7ef + 1baa97c commit 4332130
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-pots-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vue-paho-mqtt": patch
---

No WSS attempt when `useSSL` is `false`.
13 changes: 9 additions & 4 deletions src/pahoMqttPlugin/utils/connectClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ export const connectClient = ({
(MqttOptions.keepAliveInterval ||
defaultMqttOptions.keepAliveInterval!) / 1000,
cleanSession: MqttOptions.cleanSession,
uris: [
`wss://${MqttOptions.host}:${MqttOptions.port}${MqttOptions.path}`,
`ws://${MqttOptions.host}:${MqttOptions.port}${MqttOptions.path}`,
],
uris:
MqttOptions.useSSL === false
? [
`ws://${MqttOptions.host}:${MqttOptions.port}${MqttOptions.path}`,
]
: [
`wss://${MqttOptions.host}:${MqttOptions.port}${MqttOptions.path}`,
`ws://${MqttOptions.host}:${MqttOptions.port}${MqttOptions.path}`,
],
onSuccess: () => {
resolve(true);
onConnectCallback();
Expand Down

0 comments on commit 4332130

Please sign in to comment.