Socket
Socket
Sign inDemoInstall

aws-crt

Package Overview
Dependencies
Maintainers
4
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-crt - npm Package Compare versions

Comparing version 1.18.1 to 1.18.2

2

dist/native/binding.d.ts

@@ -196,2 +196,4 @@ /*

on_resumed?: (return_code: number, session_present: boolean) => void,
on_success?: (return_code: number, session_present: boolean) => void,
on_failure?: (error_code: number) => void,
tls_ctx?: NativeHandle,

@@ -198,0 +200,0 @@ will?: { topic: StringLike, payload: StringLike, qos: number, retain: boolean },

@@ -355,2 +355,4 @@ import { NativeResource } from "./native_resource";

private _reject;
private _on_connection_failure;
private _on_connection_success;
private _on_connection_interrupted;

@@ -357,0 +359,0 @@ private _on_connection_resumed;

18

dist/native/mqtt.js

@@ -133,3 +133,3 @@ "use strict";

}
this._super(binding_1.default.mqtt_client_connection_new(client.native_handle(), (error_code) => { this._on_connection_interrupted(error_code); }, (return_code, session_present) => { this._on_connection_resumed(return_code, session_present); }, config.tls_ctx ? config.tls_ctx.native_handle() : null, will, config.username, config.password, config.use_websocket, config.proxy_options ? config.proxy_options.create_native_handle() : undefined, config.websocket_handshake_transform, min_sec, max_sec));
this._super(binding_1.default.mqtt_client_connection_new(client.native_handle(), (error_code) => { this._on_connection_interrupted(error_code); }, (return_code, session_present) => { this._on_connection_resumed(return_code, session_present); }, (return_code, session_present) => { this._on_connection_success(return_code, session_present); }, (error_code) => { this._on_connection_failure(error_code); }, config.tls_ctx ? config.tls_ctx.native_handle() : null, will, config.username, config.password, config.use_websocket, config.proxy_options ? config.proxy_options.create_native_handle() : undefined, config.websocket_handshake_transform, min_sec, max_sec));
this.tls_ctx = config.tls_ctx;

@@ -338,2 +338,10 @@ binding_1.default.mqtt_client_connection_on_message(this.native_handle(), this._on_any_publish.bind(this));

}
_on_connection_failure(error_code) {
let failureCallbackData = { error: new error_1.CrtError(error_code) };
this.emit('connection_failure', failureCallbackData);
}
_on_connection_success(return_code, session_present) {
let successCallbackData = { session_present: session_present, reason_code: return_code };
this.emit('connection_success', successCallbackData);
}
_on_connection_interrupted(error_code) {

@@ -344,4 +352,2 @@ this.emit('interrupt', new error_1.CrtError(error_code));

this.emit('resume', return_code, session_present);
let successCallbackData = { session_present: session_present, reason_code: return_code };
this.emit('connection_success', successCallbackData);
}

@@ -364,14 +370,8 @@ _on_any_publish(topic, payload, dup, qos, retain) {

this.emit('connect', session_present);
let successCallbackData = { session_present: session_present, reason_code: return_code };
this.emit('connection_success', successCallbackData);
}
else if (error_code != 0) {
reject("Failed to connect: " + io.error_code_to_string(error_code));
let failureCallbackData = { error: new error_1.CrtError(error_code) };
this.emit('connection_failure', failureCallbackData);
}
else {
reject("Server rejected connection.");
let failureCallbackData = { error: new error_1.CrtError(5134) }; // 5134 = AWS_ERROR_MQTT_UNEXPECTED_HANGUP
this.emit('connection_failure', failureCallbackData);
}

@@ -378,0 +378,0 @@ }

@@ -14,2 +14,3 @@ /*

import {cRuntime, CRuntimeType} from "./binding"
import {newLiftedPromise} from "../common/promise";

@@ -201,6 +202,9 @@ test_env.conditional_test(test_env.AWS_IOT_ENV.mqtt311_is_valid_custom_auth_unsigned())('Aws Iot Core Mqtt over websockets with Non-Signing Custom Auth - Connection Success', async () => {

let failurePromise = newLiftedPromise<mqtt311.OnConnectionFailedResult>();
let client = new mqtt311.MqttClient();
let connection = client.new_connection(config);
connection.on('error', () => {});
connection.on('connection_failure', (result) => { failurePromise.resolve(result)});
const connectionFailure = once(connection, "connection_failure")
let expected_error = false;

@@ -214,3 +218,3 @@ try {

let connectionFailedEvent: mqtt311.OnConnectionFailedResult = (await connectionFailure)[0];
let connectionFailedEvent: mqtt311.OnConnectionFailedResult = await failurePromise.promise;
expect(connectionFailedEvent).toBeDefined();

@@ -217,0 +221,0 @@ expect(connectionFailedEvent.error).toBeDefined();

@@ -196,2 +196,4 @@ /*

on_resumed?: (return_code: number, session_present: boolean) => void,
on_success?: (return_code: number, session_present: boolean) => void,
on_failure?: (error_code: number) => void,
tls_ctx?: NativeHandle,

@@ -198,0 +200,0 @@ will?: { topic: StringLike, payload: StringLike, qos: number, retain: boolean },

@@ -37,3 +37,3 @@ /*

});
connection.on('connection_success', (callback_data:OnConnectionSuccessResult) => {
connection.on('connection_success', async (callback_data:OnConnectionSuccessResult) => {
expect(callback_data.session_present).toBe(false);

@@ -40,0 +40,0 @@ expect(callback_data.reason_code).toBeDefined();

@@ -313,2 +313,4 @@ /*

(return_code: number, session_present: boolean) => { this._on_connection_resumed(return_code, session_present); },
(return_code: number, session_present: boolean) => { this._on_connection_success(return_code, session_present); },
(error_code: number) => { this._on_connection_failure(error_code); },
config.tls_ctx ? config.tls_ctx.native_handle() : null,

@@ -631,2 +633,12 @@ will,

private _on_connection_failure(error_code: number) {
let failureCallbackData = { error: new CrtError(error_code) } as OnConnectionFailedResult;
this.emit('connection_failure', failureCallbackData);
}
private _on_connection_success(return_code: number, session_present: boolean) {
let successCallbackData = { session_present: session_present, reason_code: return_code } as OnConnectionSuccessResult;
this.emit('connection_success', successCallbackData);
}
private _on_connection_interrupted(error_code: number) {

@@ -638,4 +650,2 @@ this.emit('interrupt', new CrtError(error_code));

this.emit('resume', return_code, session_present);
let successCallbackData = { session_present: session_present, reason_code: return_code } as OnConnectionSuccessResult;
this.emit('connection_success', successCallbackData);
}

@@ -661,12 +671,6 @@

this.emit('connect', session_present);
let successCallbackData = { session_present: session_present, reason_code: return_code } as OnConnectionSuccessResult;
this.emit('connection_success', successCallbackData);
} else if (error_code != 0) {
reject("Failed to connect: " + io.error_code_to_string(error_code));
let failureCallbackData = { error: new CrtError(error_code) } as OnConnectionFailedResult;
this.emit('connection_failure', failureCallbackData);
} else {
reject("Server rejected connection.");
let failureCallbackData = { error: new CrtError(5134) } as OnConnectionFailedResult; // 5134 = AWS_ERROR_MQTT_UNEXPECTED_HANGUP
this.emit('connection_failure', failureCallbackData);
}

@@ -673,0 +677,0 @@ }

{
"name": "aws-crt",
"version": "1.18.1",
"version": "1.18.2",
"description": "NodeJS/browser bindings to the aws-c-* libraries",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/awslabs/aws-crt-nodejs",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc