File tree Expand file tree Collapse file tree 1 file changed +12
-15
lines changed
Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -617,24 +617,21 @@ function connect() {
617617 jQuery(" .offlineMarker" ).hide ();
618618 jQuery(" .loadingMarker" ).show ();
619619
620- if (location.protocol === 'https:')
621- {
622- client = new Paho.MQTT.Client (" $Extras.mqtt_websockets_host" , $Extras .mqtt_websockets_port_ssl , mqttclient);
623- client.onConnectionLost = onConnectionLost;
624- client.onMessageArrived = onMessageArrived;
625- var options = {useSSL: true,onSuccess:onConnect,onFailure:onFailure}
626- }
627- else
628- {
629- client = new Paho.MQTT.Client (" $Extras.mqtt_websockets_host" , $Extras .mqtt_websockets_port , mqttclient);
630- client.onConnectionLost = onConnectionLost;
631- client.onMessageArrived = onMessageArrived;
632- var options = {useSSL: false,onSuccess:onConnect,onFailure:onFailure}
633- }
620+ client = new Paho.MQTT.Client (" $Extras.mqtt_websockets_host" , $Extras .mqtt_websockets_port , mqttclient);
621+ client.onConnectionLost = onConnectionLost;
622+ client.onMessageArrived = onMessageArrived;
623+ var options = {
624+ #if $Extras .has_key (" mqtt_websockets_ssl" ) and $Extras .mqtt_websockets_ssl == '1'
625+ useSSL: true,
626+ #else
627+ useSSL: false,
628+ #end if
629+ onSuccess:onConnect,
630+ onFailure:onFailure
631+ }
634632 client.connect ( options );
635633}
636634
637-
638635// MQTT connect callback
639636function onConnect() {
640637 belchertown_debug(" MQTT Connected. Subscribing." );
You can’t perform that action at this time.
0 commit comments