Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
EventEmitter.call(this);
var self = this,
transId = 0;
this.clientId = clientId;
this.lifetime = Math.floor(devAttrs.lifetime) || 86400; // seconds
this.ip = devAttrs.ip || null;
this.mac = devAttrs.mac || null;
this.version = devAttrs.version || '0.0.1';
this.mc = null; // mqtt client
this.so = null; // smart object
if (!this.ip || !this.mac) {
network.get_active_interface(function(err, info) {
if (err) {
self.emit('error', err);
} else {
self.ip = self.ip || info.ip_address;
self.mac = self.mac || info.mac_address;
}
});
}
//----------- protected properties ---------------------
this._rspsToResolve = {};
this._pubics = {
register: `register/${this.clientId}`,
deregister: `deregister/${this.clientId}`,
notify: `notify/${this.clientId}`,