diff --git a/env.example b/env.example index 3f62998..0803a39 100644 --- a/env.example +++ b/env.example @@ -2,4 +2,5 @@ VITE_API_URL=https://api.example.com VITE_APP_NAME=MyReactApp VITE_MQTT_SERVER=mosquitto-apotek-2 # VITE_MQTT_SERVER=117.102.231.130 -VITE_MQTT_PORT=4001 \ No newline at end of file +VITE_MQTT_PORT=4001 +VITE_MQTT_PROTOCOL=mqtt \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index bcf6327..3723c7d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -42,7 +42,8 @@ function App() { const connectToMqtt = () => { try { - const connectUrl = `mqtt://${mqttOptions.host}:${mqttOptions.port}`; + // const connectUrl = `mqtt://${mqttOptions.host}:${mqttOptions.port}`; + const connectUrl = `${import.meta.env.VITE_MQTT_PROTOCOL}://${mqttOptions.host}:${mqttOptions.port}`; console.log('Attempting to connect to:', connectUrl); mqttClient = mqtt.connect(connectUrl, {