Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_onEnter: (callback, err) => {
if (callback) {
if (err) {
callback(err);
} else {
callback(null, new results.Disconnected());
}
} else if (err) {
this.emit('error', err);
}
},
connect: (connectCallback) => this._fsm.transition('connecting', connectCallback),
this._enableInputMessages((err) => {
if (err) {
/*Codes_SRS_NODE_MODULE_CLIENT_16_102: [If the retry policy fails to reestablish the C2D functionality a `disconnect` event shall be emitted with a `results.Disconnected` object.]*/
this.emit('disconnect', new results.Disconnected(err));
}
});
}
Client.prototype._disconnectHandler = function (reason) {
/*Codes_SRS_NODE_IOTHUB_CLIENT_16_004: [** The `disconnect` event shall be emitted when the client is disconnected from the server.]*/
var evt = new results.Disconnected();
evt.reason = reason;
this.emit('disconnect', evt);
};
this._enableC2D((err) => {
if (err) {
/*Codes_SRS_NODE_DEVICE_CLIENT_16_102: [If the retry policy fails to reestablish the C2D functionality a `disconnect` event shall be emitted with a `results.Disconnected` object.]*/
this.emit('disconnect', new results.Disconnected(err));
}
});
}
disconnect: (callback) => callback(null, new results.Disconnected()),
attachSenderLink: (endpoint, linkOptions, callback) => callback(new errors.NotConnectedError()),
_onEnter: (disconnectCallback, err, result) => {
if (disconnectCallback) {
if (err) {
this._safeCallback(disconnectCallback, err);
} else {
this._safeCallback(disconnectCallback, null, new results.Disconnected());
}
} else if (this._disconnectHandler) {
debug('calling upper layer disconnect handler');
debug('error passed to disconnect handler is: ' + this._getErrorName(err || new errors.NotConnectedError('rhea: connection disconnected')));
this._disconnectHandler(err || new errors.NotConnectedError('rhea: connection disconnected'));
}
},
amqpError: (err) => {
disconnect: (callback) => callback(null, new results.Disconnected()),
connect: (callback) => {
this._fsm.handle('disconnect', (err) => {
if (err) {
done(getTranslatedError(err, 'error while disconnecting'));
} else {
done(null, new results.Disconnected());
}
});
}
this._mqtt.disconnect((err, result) => {
this._fsm.transition('disconnected', disconnectCallback, err, new results.Disconnected(result));
});
},
disconnect: (disconnectCallback) => {
if (disconnectCallback) {
disconnectCallback(null, new results.Disconnected());
}
},
sendEvent: (message, sendCallback) => {