Skip to content

Commit 0a0f185

Browse files
authored
Merge pull request #248 from poblabs/revert-246-patch-1
Revert "Update belchertown.js.tmpl"
2 parents a0134a0 + 2e4f187 commit 0a0f185

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

skins/Belchertown/js/belchertown.js.tmpl

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff 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
639636
function onConnect() {
640637
belchertown_debug("MQTT Connected. Subscribing.");

0 commit comments

Comments
 (0)