Reputation: 316
I'm new with MQTT and want to create MQTT client using node.js which accepts authentication header to connect to MQTT. URL to connect is tcp://ip_address:61616 and needs username and sessionId. [Server uses activeMQ].
Please help me with this.
Upvotes: 1
Views: 348
Reputation: 132988
var mqtt = require('mqtt')
var client = mqtt.connect('tcp://ip_address', {
port: 61616,
username: 'myuser',
clientId: 'myclientid'
})
Upvotes: 1