Skip to content

Instantly share code, notes, and snippets.

@adamvr
Last active December 14, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamvr/5114932 to your computer and use it in GitHub Desktop.
Save adamvr/5114932 to your computer and use it in GitHub Desktop.
Two clients interfere with each other since they have the same client ID
node_modules
var mqtt = require('mqtt');
var client1 = mqtt.createClient()
, client2 = mqtt.createClient();
client1.on('close', function () {
console.log('client1 closing');
});
client2.on('close', function () {
console.log('client2 closing');
});
Mar 8 09:08:35 christopher mosquitto[679]: New connection from 127.0.0.1.
Mar 8 09:08:35 christopher mosquitto[679]: New client connected from 127.0.0.1 as mqttjs_d6bd6054a4c869f1.
Mar 8 09:08:35 christopher mosquitto[679]: Client mqttjs_d6bd6054a4c869f1 already connected, closing old connection.
Mar 8 09:08:35 christopher mosquitto[679]: New client connected from 127.0.0.1 as mqttjs_d6bd6054a4c869f1.
Mar 8 09:08:45 christopher mosquitto[679]: Socket read error on client mqttjs_d6bd6054a4c869f1, disconnecting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment