Reputation: 4548
I am using following code to connect to the cloud using MQTT protocol but I don't know how to connect using SSL\TLS properties.
var mqtt = require('mqtt');
var options = {
port: 8083,
host: 'wss://ovs.kontakt.io',
clientId: 'mqttjs_' + Math.random().toString(16).substr(2, 8),
username: 'test',
password: '*******',
rejectUnauthorized: false
};
var client = mqtt.connect('wss://ovs.kontakt.io', options);
client.on('connect', function() { // When connected
console.log('connected');
// subscribe to a topic
// publish a message to a topic
});
client.on('error', function(err) {
console.log(err);
});
Upvotes: 0
Views: 327