Skip to content

Commit 35b3b34

Browse files
authored
Merge pull request #5 from mvimercati/master
Propagate client disconnections to the user.
2 parents f6c2595 + c6ce9ea commit 35b3b34

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/mqtt.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Cayenne.prototype.connect = function(callback) {
4848
return callback(null, self.client);
4949
});
5050

51+
this.client.on('close', function () {
52+
self.emit("disconnect");
53+
});
54+
5155
this.client.on('message', self.onMessage.bind(self));
5256

5357
const cmdTopic = apiVersion + '/:username/'+THINGS+'/:thingId/cmd/:channel';

0 commit comments

Comments
 (0)