Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function (result) {
debug('AMQP transport connected.');
this._connected = true;
/*Codes_SRS_NODE_COMMON_AMQP_16_002: [The connect method shall establish a connection with the IoT hub instance and call the done() callback if given as argument] */
if (done) done(null, new results.Connected(result));
return null;
}.bind(this))
.catch(function (err) {
_onEnter: (applicationSuppliedSas, callback) => {
if (!applicationSuppliedSas) {
this._renewalTimeout = setTimeout(this._handleSASRenewal.bind(this), this._renewalNumberOfMilliseconds);
}
callback(null, new results.Connected());
},
_onExit: (callback) => {
.then(function (result) {
debug('AMQP transport connected.');
this._connected = true;
/*Codes_SRS_NODE_COMMON_AMQP_16_002: [The `connect` method shall establish a connection with the IoT hub instance and if given as argument call the `done` callback with a null error object in the case of success and a `results.Connected` object.]*/
safeCallback(done, null, new results.Connected(result));
return null;
}.bind(this))
.catch(function (err) {
_onEnter: (connectedCallback, connectResult) => {
/*Codes_SRS_NODE_DEVICE_MQTT_16_020: [The `connect` method shall call its callback with a `null` error parameter and a `results.Connected` response if `MqttBase` successfully connects.]*/
if (connectedCallback) connectedCallback(null, new results.Connected(connectResult));
},
/*Codes_SRS_NODE_DEVICE_MQTT_16_018: [The `connect` method shall call its callback immediately if `MqttBase` is already connected.]*/
_onEnter: (connectCallback, result) => {
/*Codes_SRS_NODE_COMMON_AMQP_16_002: [The `connect` method shall establish a connection with the IoT hub instance and if given as argument call the `done` callback with a null error object in the case of success and a `results.Connected` object.]*/
this._safeCallback(connectCallback, null, new results.Connected(result));
},
session_error: (context: EventContext) => {
connect: (policyOverride, callback) => callback(null, new results.Connected()),
disconnect: (disconnectCallback) => {
this._fsm.handle('connect', (err) => {
if (err) {
done(translateError('AMQP Transport: Could not connect', err));
} else {
done(null, new results.Connected());
}
});
}
connect: (connectCallback) => connectCallback(null, new results.Connected()),
disconnect: (disconnectCallback) => {
.then(function (result) {
debug('AMQP transport connected.');
this._connected = true;
/*Codes_SRS_NODE_COMMON_AMQP_16_002: [The `connect` method shall establish a connection with the IoT hub instance and if given as argument call the `done` callback with a null error object in the case of success and a `results.Connected` object.]*/
safeCallback(done, null, new results.Connected(result));
return null;
}.bind(this))
.catch(function (err) {
this._amqp.removeListener('client:errorReceived', connectErrorHander);
this._connected = false;
/*Codes_SRS_NODE_COMMON_AMQP_16_003: [The `connect` method shall call the `done` callback if the connection fails.] */
safeCallback(done, connectError || err);
}.bind(this));
} else {
debug('connect called when already connected.');
safeCallback(done, null, new results.Connected());
}
};
connect: (connectCallback) => connectCallback(null, new results.Connected()),
disconnect: (disconnectCallback) => this._fsm.transition('disconnecting', disconnectCallback),