diff --git a/packages/hoppscotch-app/components/realtime/Mqtt.vue b/packages/hoppscotch-app/components/realtime/Mqtt.vue index 75d9b5103..77efd5c45 100644 --- a/packages/hoppscotch-app/components/realtime/Mqtt.vue +++ b/packages/hoppscotch-app/components/realtime/Mqtt.vue @@ -11,7 +11,9 @@ -
+
+
+ + +
@@ -175,6 +196,8 @@ export default defineComponent({ log: null, manualDisconnect: false, subscriptionState: false, + username: "", + password: "", } }, computed: { @@ -225,11 +248,18 @@ export default defineComponent({ parseUrl.port !== "" ? Number(parseUrl.port) : 8081, "hoppscotch" ) - this.client.connect({ + const connectOptions = { onSuccess: this.onConnectionSuccess, onFailure: this.onConnectionFailure, - useSSL: true, - }) + useSSL: parseUrl.protocol !== "ws:", + } + if (this.username !== "") { + connectOptions.userName = this.username + } + if (this.password !== "") { + connectOptions.password = this.password + } + this.client.connect(connectOptions) this.client.onConnectionLost = this.onConnectionLost this.client.onMessageArrived = this.onMessageArrived diff --git a/packages/hoppscotch-app/components/realtime/Socketio.vue b/packages/hoppscotch-app/components/realtime/Socketio.vue index 255e66e43..0fde8c04b 100644 --- a/packages/hoppscotch-app/components/realtime/Socketio.vue +++ b/packages/hoppscotch-app/components/realtime/Socketio.vue @@ -98,6 +98,7 @@ " spellcheck="false" :disabled="connectionState" + @keyup.enter="urlValid ? toggleConnection() : null" />