netfreak30
netfreak30

Reputation: 316

How to create MQTT client with node.js?

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

Answers (1)

ralphtheninja
ralphtheninja

Reputation: 132988

var mqtt = require('mqtt')
var client  = mqtt.connect('tcp://ip_address', {
  port: 61616,
  username: 'myuser',
  clientId: 'myclientid'
})

Upvotes: 1

Related Questions