File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,7 @@ let userLastPositions = {}; // dictionary of most recent posObj keyed by user na
27
27
28
28
29
29
function dashboard_init ( ) {
30
-
31
- mqtt_init ( ) ;
30
+
32
31
map_init ( ) ;
33
32
34
33
temp_chart_init ( ) ;
@@ -60,7 +59,7 @@ function mqtt_login() {
60
59
let password = document . getElementById ( "password" ) . value ;
61
60
// For more options, see here: https://www.eclipse.org/paho/files/jsdoc/Paho.MQTT.Client.html
62
61
connectOptions = {
63
- timeout :3 ,
62
+ timeout :30 ,
64
63
userName :username ,
65
64
password :password ,
66
65
onSuccess :onConnect ,
@@ -71,6 +70,14 @@ function mqtt_login() {
71
70
72
71
// setStatus("Connecting...");
73
72
$ ( '#debug_logs' ) . append ( "MQTT Client connecting..." ) ;
73
+
74
+ const clientId = username ;
75
+ // Create a client instance
76
+ mqtt_client = new Paho . MQTT . Client ( loc . hostname , Number ( loc . port ) , clientId ) ;
77
+
78
+ // set callback handlers
79
+ mqtt_client . onConnectionLost = onConnectionLost ;
80
+ mqtt_client . onMessageArrived = onMessageArrived ;
74
81
mqtt_client . connect ( connectOptions ) ;
75
82
return false
76
83
You can’t perform that action at this time.
0 commit comments