Skip to content

Instantly share code, notes, and snippets.

@ramajd
Last active August 29, 2015 14:04
Show Gist options
  • Save ramajd/0f18daeaddefdec960b3 to your computer and use it in GitHub Desktop.
Save ramajd/0f18daeaddefdec960b3 to your computer and use it in GitHub Desktop.
var mqtt = require('mqtt');
var chid = '69432217-a8d6-4086-9d04-eea8d0ce4a55';
var deviceId = 'testDevice';
var devicePass = '2d70dd0e-1d57-4034-ac8a-3d01c76a9f45';
var c1 = mqtt.createClient(1883, 'localhost', {
clientId : deviceId,
username : deviceId,
password : devicePass
});
c1.on('connect', function(){
console.log('c1 connected');
});
var c2 = mqtt.createClient(1883, 'localhost', {
clientId : deviceId,
username : deviceId,
password : devicePass
});
c2.on('connect', function(){
console.log('c2 connected');
})
c1.subscribe(chid);
c2.subscribe(chid);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment