From 31d408a7467ca1cce29df8db26d6552b17c7f658 Mon Sep 17 00:00:00 2001
From: Blake Blackshear <blakeb@blakeshome.com>
Date: Sat, 20 Feb 2021 08:11:58 -0600
Subject: [PATCH] dynamic ws/wss selection

---
 web/src/api/mqtt.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/web/src/api/mqtt.jsx b/web/src/api/mqtt.jsx
index 2d45593c7..6268b3d62 100644
--- a/web/src/api/mqtt.jsx
+++ b/web/src/api/mqtt.jsx
@@ -34,7 +34,7 @@ export function MqttProvider({
   config,
   children,
   createWebsocket = defaultCreateWebsocket,
-  mqttUrl = `${baseUrl.replace(/^https?:/, 'ws:')}/ws`,
+  mqttUrl = `${baseUrl.replace(/^http/, 'ws')}/ws`,
 }) {
   const [state, dispatch] = useReducer(reducer, initialState);
   const wsRef = useRef();