You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwError('You should first fill the .env-example file and rename it to .env');
6
-
}
7
-
8
-
// Connection to MQTT server
9
-
constclient=mqtt.connect(
10
-
// Note: you can replace 'mqtts' per 'wss' to connect to Mosquitto using websockets (you need to activate the option on Stackhero console and to configure "Security shield" to allow your IPs).
throwError('You should first fill the .env-example file and rename it to .env');
16
7
}
17
-
);
18
8
9
+
letclient;
19
10
20
-
// This callback will be executed when a message is received on topics you subscribed (see client.subscribe below)
21
-
client.on('message',(topic,message)=>{
22
-
// message is Buffer
23
-
console.log(`[${topic}]: ${message.toString()}`);
24
-
});
11
+
// Connect to the MQTT server
12
+
console.log('Connecting...');
13
+
client=awaitmqtt.connectAsync(
14
+
// Note: you can replace 'mqtts' per 'wss' to connect to Mosquitto using websockets (you need to activate the option on Stackhero console and to configure "Security shield" to allow your IPs).
0 commit comments