Comparing version
@@ -121,2 +121,9 @@ /** | ||
on_resumed?: (return_code: number, session_present: boolean) => void, | ||
tls_ctx?: NativeHandle, | ||
will?: { topic: StringLike, payload: String | Object | DataView, qos: number, retain: boolean }, | ||
username?: StringLike, | ||
password?: StringLike, | ||
use_websocket?: boolean, | ||
proxy_options?: NativeHandle, | ||
websocket_handshake_transform?: (request: HttpRequest, done: (error_code?: number) => void) => void, | ||
): NativeHandle; | ||
@@ -130,14 +137,7 @@ | ||
port: number, | ||
tls_ctx?: NativeHandle, | ||
socket_options?: NativeHandle, | ||
keep_alive_time?: number, | ||
timeout?: number, | ||
will?: { topic: StringLike, payload: String | Object | DataView, qos: number, retain: boolean }, | ||
username?: StringLike, | ||
password?: StringLike, | ||
use_websocket?: boolean, | ||
proxy_options?: NativeHandle, | ||
clean_session?: boolean, | ||
on_connect?: mqtt_on_connect, | ||
websocket_handshake_transform?: (request: any, done: (error_code?: number) => void) => void, | ||
): void; | ||
@@ -144,0 +144,0 @@ |
@@ -114,4 +114,9 @@ "use strict"; | ||
this.config = config; | ||
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); })); | ||
// If there is a will, ensure that its payload is normalized to a DataView | ||
const will = config.will ? | ||
new mqtt_1.MqttWill(config.will.topic, config.will.qos, normalize_payload(config.will.payload), config.will.retain) | ||
: undefined; | ||
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)); | ||
this.tls_ctx = config.tls_ctx; | ||
binding_1.default.mqtt_client_connection_on_message(this.native_handle(), this._on_any_publish.bind(this)); | ||
} | ||
@@ -155,9 +160,4 @@ close() { | ||
}; | ||
// If there is a will, ensure that its payload is normalized to a DataView | ||
const will = this.config.will ? | ||
new mqtt_1.MqttWill(this.config.will.topic, this.config.will.qos, normalize_payload(this.config.will.payload), this.config.will.retain) | ||
: undefined; | ||
try { | ||
binding_1.default.mqtt_client_connection_on_message(this.native_handle(), this._on_any_publish.bind(this)); | ||
binding_1.default.mqtt_client_connection_connect(this.native_handle(), this.config.client_id, this.config.host_name, this.config.port, this.config.tls_ctx ? this.config.tls_ctx.native_handle() : null, this.config.socket_options.native_handle(), this.config.keep_alive, this.config.timeout, will, this.config.username, this.config.password, this.config.use_websocket, this.config.proxy_options ? this.config.proxy_options.create_native_handle() : undefined, this.config.clean_session, on_connect, this.config.websocket_handshake_transform); | ||
binding_1.default.mqtt_client_connection_connect(this.native_handle(), this.config.client_id, this.config.host_name, this.config.port, this.config.socket_options.native_handle(), this.config.keep_alive, this.config.timeout, this.config.clean_session, on_connect); | ||
} | ||
@@ -164,0 +164,0 @@ catch (e) { |
{ | ||
"name": "aws-crt", | ||
"version": "1.3.7", | ||
"version": "1.3.8", | ||
"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
17355839
0.04%14217
-0.01%