mqtt5-wasm 0.7.2 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,7 @@ npm install mqtt5-wasm
26
26
 
27
27
  ```toml
28
28
  [dependencies]
29
- mqtt5-wasm = "0.7"
29
+ mqtt5-wasm = "0.8"
30
30
  ```
31
31
 
32
32
  Build with wasm-pack:
package/mqtt5_wasm.d.ts CHANGED
@@ -70,10 +70,14 @@ export class WasmBroker {
70
70
  */
71
71
  remove_bridge(name: string): Promise<void>;
72
72
  unassign_role(username: string, role_name: string): Promise<boolean>;
73
+ update_config(new_config: WasmBrokerConfig): void;
73
74
  acl_rule_count(): Promise<number>;
74
75
  get_user_roles(username: string): Promise<string[]>;
75
76
  clear_acl_rules(): Promise<void>;
77
+ get_config_hash(): number;
78
+ get_max_clients(): number;
76
79
  stop_sys_topics(): void;
80
+ on_config_change(callback: Function): void;
77
81
  start_sys_topics(): void;
78
82
  stop_all_bridges(): Promise<void>;
79
83
  add_user_with_hash(username: string, password_hash: string): Promise<void>;
@@ -82,6 +86,10 @@ export class WasmBroker {
82
86
  * Returns an error if the `MessageChannel` cannot be created.
83
87
  */
84
88
  create_client_port(): MessagePort;
89
+ get_max_packet_size(): number;
90
+ set_acl_default_deny(): Promise<void>;
91
+ set_acl_default_allow(): Promise<void>;
92
+ get_session_expiry_interval_secs(): number;
85
93
  start_sys_topics_with_interval_secs(interval_secs: number): void;
86
94
  /**
87
95
  * # Errors
@@ -118,7 +126,10 @@ export class WasmConnectOptions {
118
126
  free(): void;
119
127
  [Symbol.dispose](): void;
120
128
  clear_will(): void;
129
+ addBackupUrl(url: string): void;
130
+ getBackupUrls(): string[];
121
131
  addUserProperty(key: string, value: string): void;
132
+ clearBackupUrls(): void;
122
133
  clearUserProperties(): void;
123
134
  constructor();
124
135
  set_will(will: WasmWillMessage): void;
@@ -189,7 +200,10 @@ export class WasmMqttClient {
189
200
  */
190
201
  respond_auth(auth_data: Uint8Array): void;
191
202
  on_disconnect(callback: Function): void;
203
+ is_reconnecting(): boolean;
204
+ on_reconnecting(callback: Function): void;
192
205
  on_auth_challenge(callback: Function): void;
206
+ on_reconnect_failed(callback: Function): void;
193
207
  /**
194
208
  * # Errors
195
209
  * Returns an error if connection fails.
@@ -205,6 +219,8 @@ export class WasmMqttClient {
205
219
  * Returns an error if not connected or publish fails.
206
220
  */
207
221
  publish_with_options(topic: string, payload: Uint8Array, options: WasmPublishOptions): Promise<void>;
222
+ enable_auto_reconnect(enabled: boolean): void;
223
+ set_reconnect_options(options: WasmReconnectOptions): void;
208
224
  /**
209
225
  * # Errors
210
226
  * Returns an error if not connected or subscribe fails.
@@ -265,6 +281,19 @@ export class WasmPublishOptions {
265
281
  qos: number;
266
282
  }
267
283
 
284
+ export class WasmReconnectOptions {
285
+ free(): void;
286
+ [Symbol.dispose](): void;
287
+ constructor();
288
+ static disabled(): WasmReconnectOptions;
289
+ maxDelayMs: number;
290
+ get maxAttempts(): number | undefined;
291
+ set maxAttempts(value: number | null | undefined);
292
+ enabled: boolean;
293
+ backoffFactor: number;
294
+ initialDelayMs: number;
295
+ }
296
+
268
297
  export class WasmSubscribeOptions {
269
298
  free(): void;
270
299
  [Symbol.dispose](): void;
@@ -314,6 +343,7 @@ export interface InitOutput {
314
343
  readonly __wbg_wasmmessageproperties_free: (a: number, b: number) => void;
315
344
  readonly __wbg_wasmmqttclient_free: (a: number, b: number) => void;
316
345
  readonly __wbg_wasmpublishoptions_free: (a: number, b: number) => void;
346
+ readonly __wbg_wasmreconnectoptions_free: (a: number, b: number) => void;
317
347
  readonly __wbg_wasmsubscribeoptions_free: (a: number, b: number) => void;
318
348
  readonly __wbg_wasmtopicmapping_free: (a: number, b: number) => void;
319
349
  readonly __wbg_wasmwillmessage_free: (a: number, b: number) => void;
@@ -336,21 +366,29 @@ export interface InitOutput {
336
366
  readonly wasmbroker_clear_acl_rules: (a: number) => any;
337
367
  readonly wasmbroker_clear_roles: (a: number) => any;
338
368
  readonly wasmbroker_create_client_port: (a: number) => [number, number, number];
369
+ readonly wasmbroker_get_config_hash: (a: number) => number;
370
+ readonly wasmbroker_get_max_clients: (a: number) => number;
371
+ readonly wasmbroker_get_max_packet_size: (a: number) => number;
372
+ readonly wasmbroker_get_session_expiry_interval_secs: (a: number) => number;
339
373
  readonly wasmbroker_get_user_roles: (a: number, b: number, c: number) => any;
340
374
  readonly wasmbroker_has_user: (a: number, b: number, c: number) => any;
341
375
  readonly wasmbroker_hash_password: (a: number, b: number) => [number, number, number, number];
342
376
  readonly wasmbroker_list_bridges: (a: number) => [number, number];
343
377
  readonly wasmbroker_list_roles: (a: number) => any;
344
378
  readonly wasmbroker_new: () => [number, number, number];
379
+ readonly wasmbroker_on_config_change: (a: number, b: any) => void;
345
380
  readonly wasmbroker_remove_bridge: (a: number, b: number, c: number) => any;
346
381
  readonly wasmbroker_remove_role: (a: number, b: number, c: number) => any;
347
382
  readonly wasmbroker_remove_user: (a: number, b: number, c: number) => any;
348
383
  readonly wasmbroker_role_count: (a: number) => any;
384
+ readonly wasmbroker_set_acl_default_allow: (a: number) => any;
385
+ readonly wasmbroker_set_acl_default_deny: (a: number) => any;
349
386
  readonly wasmbroker_start_sys_topics: (a: number) => void;
350
387
  readonly wasmbroker_start_sys_topics_with_interval_secs: (a: number, b: number) => void;
351
388
  readonly wasmbroker_stop_all_bridges: (a: number) => any;
352
389
  readonly wasmbroker_stop_sys_topics: (a: number) => void;
353
390
  readonly wasmbroker_unassign_role: (a: number, b: number, c: number, d: number, e: number) => any;
391
+ readonly wasmbroker_update_config: (a: number, b: number) => [number, number];
354
392
  readonly wasmbroker_user_count: (a: number) => any;
355
393
  readonly wasmbroker_with_config: (a: number) => [number, number, number];
356
394
  readonly wasmbrokerconfig_new: () => number;
@@ -365,11 +403,14 @@ export interface InitOutput {
365
403
  readonly wasmbrokerconfig_set_subscription_identifier_available: (a: number, b: number) => void;
366
404
  readonly wasmbrokerconfig_set_topic_alias_maximum: (a: number, b: number) => void;
367
405
  readonly wasmbrokerconfig_set_wildcard_subscription_available: (a: number, b: number) => void;
406
+ readonly wasmconnectoptions_addBackupUrl: (a: number, b: number, c: number) => void;
368
407
  readonly wasmconnectoptions_addUserProperty: (a: number, b: number, c: number, d: number, e: number) => void;
369
408
  readonly wasmconnectoptions_authenticationMethod: (a: number) => [number, number];
370
409
  readonly wasmconnectoptions_cleanStart: (a: number) => number;
410
+ readonly wasmconnectoptions_clearBackupUrls: (a: number) => void;
371
411
  readonly wasmconnectoptions_clearUserProperties: (a: number) => void;
372
412
  readonly wasmconnectoptions_clear_will: (a: number) => void;
413
+ readonly wasmconnectoptions_getBackupUrls: (a: number) => [number, number];
373
414
  readonly wasmconnectoptions_keepAlive: (a: number) => number;
374
415
  readonly wasmconnectoptions_maximumPacketSize: (a: number) => number;
375
416
  readonly wasmconnectoptions_new: () => number;
@@ -407,17 +448,22 @@ export interface InitOutput {
407
448
  readonly wasmmqttclient_connect_message_port_with_options: (a: number, b: any, c: number) => any;
408
449
  readonly wasmmqttclient_connect_with_options: (a: number, b: number, c: number, d: number) => any;
409
450
  readonly wasmmqttclient_disconnect: (a: number) => any;
451
+ readonly wasmmqttclient_enable_auto_reconnect: (a: number, b: number) => void;
410
452
  readonly wasmmqttclient_is_connected: (a: number) => number;
453
+ readonly wasmmqttclient_is_reconnecting: (a: number) => number;
411
454
  readonly wasmmqttclient_new: (a: number, b: number) => number;
412
455
  readonly wasmmqttclient_on_auth_challenge: (a: number, b: any) => void;
413
456
  readonly wasmmqttclient_on_connect: (a: number, b: any) => void;
414
457
  readonly wasmmqttclient_on_disconnect: (a: number, b: any) => void;
415
458
  readonly wasmmqttclient_on_error: (a: number, b: any) => void;
459
+ readonly wasmmqttclient_on_reconnect_failed: (a: number, b: any) => void;
460
+ readonly wasmmqttclient_on_reconnecting: (a: number, b: any) => void;
416
461
  readonly wasmmqttclient_publish: (a: number, b: number, c: number, d: number, e: number) => any;
417
462
  readonly wasmmqttclient_publish_qos1: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
418
463
  readonly wasmmqttclient_publish_qos2: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
419
464
  readonly wasmmqttclient_publish_with_options: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
420
465
  readonly wasmmqttclient_respond_auth: (a: number, b: number, c: number) => [number, number];
466
+ readonly wasmmqttclient_set_reconnect_options: (a: number, b: number) => void;
421
467
  readonly wasmmqttclient_subscribe: (a: number, b: number, c: number) => any;
422
468
  readonly wasmmqttclient_subscribe_with_callback: (a: number, b: number, c: number, d: any) => any;
423
469
  readonly wasmmqttclient_subscribe_with_options: (a: number, b: number, c: number, d: any, e: number) => any;
@@ -440,6 +486,18 @@ export interface InitOutput {
440
486
  readonly wasmpublishoptions_set_retain: (a: number, b: number) => void;
441
487
  readonly wasmpublishoptions_set_topicAlias: (a: number, b: number) => void;
442
488
  readonly wasmpublishoptions_topicAlias: (a: number) => number;
489
+ readonly wasmreconnectoptions_backoffFactor: (a: number) => number;
490
+ readonly wasmreconnectoptions_disabled: () => number;
491
+ readonly wasmreconnectoptions_enabled: (a: number) => number;
492
+ readonly wasmreconnectoptions_initialDelayMs: (a: number) => number;
493
+ readonly wasmreconnectoptions_maxAttempts: (a: number) => number;
494
+ readonly wasmreconnectoptions_maxDelayMs: (a: number) => number;
495
+ readonly wasmreconnectoptions_new: () => number;
496
+ readonly wasmreconnectoptions_set_backoffFactor: (a: number, b: number) => void;
497
+ readonly wasmreconnectoptions_set_enabled: (a: number, b: number) => void;
498
+ readonly wasmreconnectoptions_set_initialDelayMs: (a: number, b: number) => void;
499
+ readonly wasmreconnectoptions_set_maxAttempts: (a: number, b: number) => void;
500
+ readonly wasmreconnectoptions_set_maxDelayMs: (a: number, b: number) => void;
443
501
  readonly wasmsubscribeoptions_new: () => number;
444
502
  readonly wasmsubscribeoptions_noLocal: (a: number) => number;
445
503
  readonly wasmsubscribeoptions_qos: (a: number) => number;
@@ -470,13 +528,13 @@ export interface InitOutput {
470
528
  readonly wasmwillmessage_set_willDelayInterval: (a: number, b: number) => void;
471
529
  readonly wasmwillmessage_topic: (a: number) => [number, number];
472
530
  readonly wasmwillmessage_willDelayInterval: (a: number) => number;
473
- readonly wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b: (a: number, b: number) => void;
474
- readonly wasm_bindgen__closure__destroy__he9d43d9a42a0e056: (a: number, b: number) => void;
475
- readonly wasm_bindgen__convert__closures_____invoke__h7e1020caa6d4bdff: (a: number, b: number, c: any) => void;
476
- readonly wasm_bindgen__closure__destroy__h523d3e4e33cf7d1b: (a: number, b: number) => void;
477
- readonly wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0: (a: number, b: number, c: any) => void;
478
- readonly wasm_bindgen__closure__destroy__h849099dfd9acf928: (a: number, b: number) => void;
479
- readonly wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf: (a: number, b: number, c: any, d: any) => void;
531
+ readonly wasm_bindgen__convert__closures_____invoke__h31c8cca720a6aff9: (a: number, b: number, c: any) => void;
532
+ readonly wasm_bindgen__closure__destroy__h41b20611c4407cba: (a: number, b: number) => void;
533
+ readonly wasm_bindgen__convert__closures_____invoke__h8d4b77242b184668: (a: number, b: number, c: any) => void;
534
+ readonly wasm_bindgen__closure__destroy__h1683131c23930486: (a: number, b: number) => void;
535
+ readonly wasm_bindgen__convert__closures_____invoke__h3ae4cd55a0542d01: (a: number, b: number) => void;
536
+ readonly wasm_bindgen__closure__destroy__h318cda49ff0041e4: (a: number, b: number) => void;
537
+ readonly wasm_bindgen__convert__closures_____invoke__h7ae096ff8d5e6a9b: (a: number, b: number, c: any, d: any) => void;
480
538
  readonly __wbindgen_malloc: (a: number, b: number) => number;
481
539
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
482
540
  readonly __wbindgen_exn_store: (a: number) => void;
package/mqtt5_wasm.js CHANGED
@@ -251,20 +251,20 @@ if (!('encodeInto' in cachedTextEncoder)) {
251
251
 
252
252
  let WASM_VECTOR_LEN = 0;
253
253
 
254
- function wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b(arg0, arg1) {
255
- wasm.wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b(arg0, arg1);
254
+ function wasm_bindgen__convert__closures_____invoke__h31c8cca720a6aff9(arg0, arg1, arg2) {
255
+ wasm.wasm_bindgen__convert__closures_____invoke__h31c8cca720a6aff9(arg0, arg1, arg2);
256
256
  }
257
257
 
258
- function wasm_bindgen__convert__closures_____invoke__h7e1020caa6d4bdff(arg0, arg1, arg2) {
259
- wasm.wasm_bindgen__convert__closures_____invoke__h7e1020caa6d4bdff(arg0, arg1, arg2);
258
+ function wasm_bindgen__convert__closures_____invoke__h8d4b77242b184668(arg0, arg1, arg2) {
259
+ wasm.wasm_bindgen__convert__closures_____invoke__h8d4b77242b184668(arg0, arg1, arg2);
260
260
  }
261
261
 
262
- function wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(arg0, arg1, arg2) {
263
- wasm.wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(arg0, arg1, arg2);
262
+ function wasm_bindgen__convert__closures_____invoke__h3ae4cd55a0542d01(arg0, arg1) {
263
+ wasm.wasm_bindgen__convert__closures_____invoke__h3ae4cd55a0542d01(arg0, arg1);
264
264
  }
265
265
 
266
- function wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(arg0, arg1, arg2, arg3) {
267
- wasm.wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(arg0, arg1, arg2, arg3);
266
+ function wasm_bindgen__convert__closures_____invoke__h7ae096ff8d5e6a9b(arg0, arg1, arg2, arg3) {
267
+ wasm.wasm_bindgen__convert__closures_____invoke__h7ae096ff8d5e6a9b(arg0, arg1, arg2, arg3);
268
268
  }
269
269
 
270
270
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -297,6 +297,10 @@ const WasmPublishOptionsFinalization = (typeof FinalizationRegistry === 'undefin
297
297
  ? { register: () => {}, unregister: () => {} }
298
298
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmpublishoptions_free(ptr >>> 0, 1));
299
299
 
300
+ const WasmReconnectOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
301
+ ? { register: () => {}, unregister: () => {} }
302
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmreconnectoptions_free(ptr >>> 0, 1));
303
+
300
304
  const WasmSubscribeOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
301
305
  ? { register: () => {}, unregister: () => {} }
302
306
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmsubscribeoptions_free(ptr >>> 0, 1));
@@ -602,6 +606,17 @@ export class WasmBroker {
602
606
  const ret = wasm.wasmbroker_unassign_role(this.__wbg_ptr, ptr0, len0, ptr1, len1);
603
607
  return ret;
604
608
  }
609
+ /**
610
+ * @param {WasmBrokerConfig} new_config
611
+ */
612
+ update_config(new_config) {
613
+ _assertClass(new_config, WasmBrokerConfig);
614
+ var ptr0 = new_config.__destroy_into_raw();
615
+ const ret = wasm.wasmbroker_update_config(this.__wbg_ptr, ptr0);
616
+ if (ret[1]) {
617
+ throw takeFromExternrefTable0(ret[0]);
618
+ }
619
+ }
605
620
  /**
606
621
  * @returns {Promise<number>}
607
622
  */
@@ -626,9 +641,29 @@ export class WasmBroker {
626
641
  const ret = wasm.wasmbroker_clear_acl_rules(this.__wbg_ptr);
627
642
  return ret;
628
643
  }
644
+ /**
645
+ * @returns {number}
646
+ */
647
+ get_config_hash() {
648
+ const ret = wasm.wasmbroker_get_config_hash(this.__wbg_ptr);
649
+ return ret;
650
+ }
651
+ /**
652
+ * @returns {number}
653
+ */
654
+ get_max_clients() {
655
+ const ret = wasm.wasmbroker_get_max_clients(this.__wbg_ptr);
656
+ return ret >>> 0;
657
+ }
629
658
  stop_sys_topics() {
630
659
  wasm.wasmbroker_stop_sys_topics(this.__wbg_ptr);
631
660
  }
661
+ /**
662
+ * @param {Function} callback
663
+ */
664
+ on_config_change(callback) {
665
+ wasm.wasmbroker_on_config_change(this.__wbg_ptr, callback);
666
+ }
632
667
  start_sys_topics() {
633
668
  wasm.wasmbroker_start_sys_topics(this.__wbg_ptr);
634
669
  }
@@ -664,6 +699,34 @@ export class WasmBroker {
664
699
  }
665
700
  return takeFromExternrefTable0(ret[0]);
666
701
  }
702
+ /**
703
+ * @returns {number}
704
+ */
705
+ get_max_packet_size() {
706
+ const ret = wasm.wasmbroker_get_max_packet_size(this.__wbg_ptr);
707
+ return ret >>> 0;
708
+ }
709
+ /**
710
+ * @returns {Promise<void>}
711
+ */
712
+ set_acl_default_deny() {
713
+ const ret = wasm.wasmbroker_set_acl_default_deny(this.__wbg_ptr);
714
+ return ret;
715
+ }
716
+ /**
717
+ * @returns {Promise<void>}
718
+ */
719
+ set_acl_default_allow() {
720
+ const ret = wasm.wasmbroker_set_acl_default_allow(this.__wbg_ptr);
721
+ return ret;
722
+ }
723
+ /**
724
+ * @returns {number}
725
+ */
726
+ get_session_expiry_interval_secs() {
727
+ const ret = wasm.wasmbroker_get_session_expiry_interval_secs(this.__wbg_ptr);
728
+ return ret >>> 0;
729
+ }
667
730
  /**
668
731
  * @param {number} interval_secs
669
732
  */
@@ -828,6 +891,14 @@ export class WasmConnectOptions {
828
891
  clear_will() {
829
892
  wasm.wasmconnectoptions_clear_will(this.__wbg_ptr);
830
893
  }
894
+ /**
895
+ * @param {string} url
896
+ */
897
+ addBackupUrl(url) {
898
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
899
+ const len0 = WASM_VECTOR_LEN;
900
+ wasm.wasmconnectoptions_addBackupUrl(this.__wbg_ptr, ptr0, len0);
901
+ }
831
902
  /**
832
903
  * @param {Uint8Array} value
833
904
  */
@@ -844,6 +915,15 @@ export class WasmConnectOptions {
844
915
  var len0 = WASM_VECTOR_LEN;
845
916
  wasm.wasmconnectoptions_set_username(this.__wbg_ptr, ptr0, len0);
846
917
  }
918
+ /**
919
+ * @returns {string[]}
920
+ */
921
+ getBackupUrls() {
922
+ const ret = wasm.wasmconnectoptions_getBackupUrls(this.__wbg_ptr);
923
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
924
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
925
+ return v1;
926
+ }
847
927
  /**
848
928
  * @param {number} value
849
929
  */
@@ -874,6 +954,9 @@ export class WasmConnectOptions {
874
954
  const len1 = WASM_VECTOR_LEN;
875
955
  wasm.wasmconnectoptions_addUserProperty(this.__wbg_ptr, ptr0, len0, ptr1, len1);
876
956
  }
957
+ clearBackupUrls() {
958
+ wasm.wasmconnectoptions_clearBackupUrls(this.__wbg_ptr);
959
+ }
877
960
  /**
878
961
  * @returns {number}
879
962
  */
@@ -1208,12 +1291,31 @@ export class WasmMqttClient {
1208
1291
  on_disconnect(callback) {
1209
1292
  wasm.wasmmqttclient_on_disconnect(this.__wbg_ptr, callback);
1210
1293
  }
1294
+ /**
1295
+ * @returns {boolean}
1296
+ */
1297
+ is_reconnecting() {
1298
+ const ret = wasm.wasmmqttclient_is_reconnecting(this.__wbg_ptr);
1299
+ return ret !== 0;
1300
+ }
1301
+ /**
1302
+ * @param {Function} callback
1303
+ */
1304
+ on_reconnecting(callback) {
1305
+ wasm.wasmmqttclient_on_reconnecting(this.__wbg_ptr, callback);
1306
+ }
1211
1307
  /**
1212
1308
  * @param {Function} callback
1213
1309
  */
1214
1310
  on_auth_challenge(callback) {
1215
1311
  wasm.wasmmqttclient_on_auth_challenge(this.__wbg_ptr, callback);
1216
1312
  }
1313
+ /**
1314
+ * @param {Function} callback
1315
+ */
1316
+ on_reconnect_failed(callback) {
1317
+ wasm.wasmmqttclient_on_reconnect_failed(this.__wbg_ptr, callback);
1318
+ }
1217
1319
  /**
1218
1320
  * # Errors
1219
1321
  * Returns an error if connection fails.
@@ -1255,6 +1357,19 @@ export class WasmMqttClient {
1255
1357
  const ret = wasm.wasmmqttclient_publish_with_options(this.__wbg_ptr, ptr0, len0, ptr1, len1, options.__wbg_ptr);
1256
1358
  return ret;
1257
1359
  }
1360
+ /**
1361
+ * @param {boolean} enabled
1362
+ */
1363
+ enable_auto_reconnect(enabled) {
1364
+ wasm.wasmmqttclient_enable_auto_reconnect(this.__wbg_ptr, enabled);
1365
+ }
1366
+ /**
1367
+ * @param {WasmReconnectOptions} options
1368
+ */
1369
+ set_reconnect_options(options) {
1370
+ _assertClass(options, WasmReconnectOptions);
1371
+ wasm.wasmmqttclient_set_reconnect_options(this.__wbg_ptr, options.__wbg_ptr);
1372
+ }
1258
1373
  /**
1259
1374
  * # Errors
1260
1375
  * Returns an error if not connected or subscribe fails.
@@ -1513,6 +1628,105 @@ export class WasmPublishOptions {
1513
1628
  }
1514
1629
  if (Symbol.dispose) WasmPublishOptions.prototype[Symbol.dispose] = WasmPublishOptions.prototype.free;
1515
1630
 
1631
+ export class WasmReconnectOptions {
1632
+ static __wrap(ptr) {
1633
+ ptr = ptr >>> 0;
1634
+ const obj = Object.create(WasmReconnectOptions.prototype);
1635
+ obj.__wbg_ptr = ptr;
1636
+ WasmReconnectOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
1637
+ return obj;
1638
+ }
1639
+ __destroy_into_raw() {
1640
+ const ptr = this.__wbg_ptr;
1641
+ this.__wbg_ptr = 0;
1642
+ WasmReconnectOptionsFinalization.unregister(this);
1643
+ return ptr;
1644
+ }
1645
+ free() {
1646
+ const ptr = this.__destroy_into_raw();
1647
+ wasm.__wbg_wasmreconnectoptions_free(ptr, 0);
1648
+ }
1649
+ /**
1650
+ * @returns {number}
1651
+ */
1652
+ get maxDelayMs() {
1653
+ const ret = wasm.wasmreconnectoptions_maxDelayMs(this.__wbg_ptr);
1654
+ return ret >>> 0;
1655
+ }
1656
+ /**
1657
+ * @returns {number | undefined}
1658
+ */
1659
+ get maxAttempts() {
1660
+ const ret = wasm.wasmreconnectoptions_maxAttempts(this.__wbg_ptr);
1661
+ return ret === 0x100000001 ? undefined : ret;
1662
+ }
1663
+ /**
1664
+ * @param {boolean} value
1665
+ */
1666
+ set enabled(value) {
1667
+ wasm.wasmreconnectoptions_set_enabled(this.__wbg_ptr, value);
1668
+ }
1669
+ /**
1670
+ * @returns {number}
1671
+ */
1672
+ get backoffFactor() {
1673
+ const ret = wasm.wasmreconnectoptions_backoffFactor(this.__wbg_ptr);
1674
+ return ret;
1675
+ }
1676
+ /**
1677
+ * @returns {number}
1678
+ */
1679
+ get initialDelayMs() {
1680
+ const ret = wasm.wasmreconnectoptions_initialDelayMs(this.__wbg_ptr);
1681
+ return ret >>> 0;
1682
+ }
1683
+ /**
1684
+ * @param {number} value
1685
+ */
1686
+ set maxDelayMs(value) {
1687
+ wasm.wasmreconnectoptions_set_maxDelayMs(this.__wbg_ptr, value);
1688
+ }
1689
+ /**
1690
+ * @param {number | null} [value]
1691
+ */
1692
+ set maxAttempts(value) {
1693
+ wasm.wasmreconnectoptions_set_maxAttempts(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1694
+ }
1695
+ /**
1696
+ * @param {number} value
1697
+ */
1698
+ set backoffFactor(value) {
1699
+ wasm.wasmreconnectoptions_set_backoffFactor(this.__wbg_ptr, value);
1700
+ }
1701
+ /**
1702
+ * @param {number} value
1703
+ */
1704
+ set initialDelayMs(value) {
1705
+ wasm.wasmreconnectoptions_set_initialDelayMs(this.__wbg_ptr, value);
1706
+ }
1707
+ constructor() {
1708
+ const ret = wasm.wasmreconnectoptions_new();
1709
+ this.__wbg_ptr = ret >>> 0;
1710
+ WasmReconnectOptionsFinalization.register(this, this.__wbg_ptr, this);
1711
+ return this;
1712
+ }
1713
+ /**
1714
+ * @returns {boolean}
1715
+ */
1716
+ get enabled() {
1717
+ const ret = wasm.wasmreconnectoptions_enabled(this.__wbg_ptr);
1718
+ return ret !== 0;
1719
+ }
1720
+ /**
1721
+ * @returns {WasmReconnectOptions}
1722
+ */
1723
+ static disabled() {
1724
+ const ret = wasm.wasmreconnectoptions_disabled();
1725
+ return WasmReconnectOptions.__wrap(ret);
1726
+ }
1727
+ }
1728
+ if (Symbol.dispose) WasmReconnectOptions.prototype[Symbol.dispose] = WasmReconnectOptions.prototype.free;
1729
+
1516
1730
  export class WasmSubscribeOptions {
1517
1731
  __destroy_into_raw() {
1518
1732
  const ptr = this.__wbg_ptr;
@@ -1839,6 +2053,12 @@ function __wbg_get_imports() {
1839
2053
  const ret = arg0 === undefined;
1840
2054
  return ret;
1841
2055
  };
2056
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
2057
+ const obj = arg1;
2058
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2059
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2060
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2061
+ };
1842
2062
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1843
2063
  throw new Error(getStringFromWasm0(arg0, arg1));
1844
2064
  };
@@ -1899,9 +2119,17 @@ function __wbg_get_imports() {
1899
2119
  imports.wbg.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
1900
2120
  console.error(arg0);
1901
2121
  };
2122
+ imports.wbg.__wbg_from_29a8414a7a7cd19d = function(arg0) {
2123
+ const ret = Array.from(arg0);
2124
+ return ret;
2125
+ };
1902
2126
  imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
1903
2127
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1904
2128
  }, arguments) };
2129
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
2130
+ const ret = arg0[arg1 >>> 0];
2131
+ return ret;
2132
+ };
1905
2133
  imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1906
2134
  let result;
1907
2135
  try {
@@ -1926,6 +2154,10 @@ function __wbg_get_imports() {
1926
2154
  const ret = arg0.length;
1927
2155
  return ret;
1928
2156
  };
2157
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
2158
+ const ret = arg0.length;
2159
+ return ret;
2160
+ };
1929
2161
  imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
1930
2162
  console.log(arg0);
1931
2163
  };
@@ -1956,7 +2188,7 @@ function __wbg_get_imports() {
1956
2188
  const a = state0.a;
1957
2189
  state0.a = 0;
1958
2190
  try {
1959
- return wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(a, state0.b, arg0, arg1);
2191
+ return wasm_bindgen__convert__closures_____invoke__h7ae096ff8d5e6a9b(a, state0.b, arg0, arg1);
1960
2192
  } finally {
1961
2193
  state0.a = a;
1962
2194
  }
@@ -2019,6 +2251,10 @@ function __wbg_get_imports() {
2019
2251
  imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
2020
2252
  queueMicrotask(arg0);
2021
2253
  };
2254
+ imports.wbg.__wbg_random_cc1f9237d866d212 = function() {
2255
+ const ret = Math.random();
2256
+ return ret;
2257
+ };
2022
2258
  imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
2023
2259
  const ret = Promise.resolve(arg0);
2024
2260
  return ret;
@@ -2108,19 +2344,24 @@ function __wbg_get_imports() {
2108
2344
  const ret = v0;
2109
2345
  return ret;
2110
2346
  };
2111
- imports.wbg.__wbindgen_cast_7249b77047b5c954 = function(arg0, arg1) {
2112
- // Cast intrinsic for `Closure(Closure { dtor_idx: 355, function: Function { arguments: [], shim_idx: 356, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2113
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he9d43d9a42a0e056, wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b);
2347
+ imports.wbg.__wbindgen_cast_9962933c44dc73b0 = function(arg0, arg1) {
2348
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 382, function: Function { arguments: [Externref], shim_idx: 383, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2349
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h41b20611c4407cba, wasm_bindgen__convert__closures_____invoke__h31c8cca720a6aff9);
2114
2350
  return ret;
2115
2351
  };
2116
2352
  imports.wbg.__wbindgen_cast_a6d58121ace2ceaa = function(arg0, arg1) {
2117
2353
  // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2118
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h523d3e4e33cf7d1b, wasm_bindgen__convert__closures_____invoke__h7e1020caa6d4bdff);
2354
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1683131c23930486, wasm_bindgen__convert__closures_____invoke__h8d4b77242b184668);
2355
+ return ret;
2356
+ };
2357
+ imports.wbg.__wbindgen_cast_a8d66839b968d1de = function(arg0, arg1) {
2358
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 371, function: Function { arguments: [], shim_idx: 372, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2359
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h318cda49ff0041e4, wasm_bindgen__convert__closures_____invoke__h3ae4cd55a0542d01);
2119
2360
  return ret;
2120
2361
  };
2121
2362
  imports.wbg.__wbindgen_cast_d3f7166d7f91ad34 = function(arg0, arg1) {
2122
2363
  // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2123
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h523d3e4e33cf7d1b, wasm_bindgen__convert__closures_____invoke__h7e1020caa6d4bdff);
2364
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1683131c23930486, wasm_bindgen__convert__closures_____invoke__h8d4b77242b184668);
2124
2365
  return ret;
2125
2366
  };
2126
2367
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
@@ -2128,14 +2369,9 @@ function __wbg_get_imports() {
2128
2369
  const ret = arg0;
2129
2370
  return ret;
2130
2371
  };
2131
- imports.wbg.__wbindgen_cast_e7f97fba0726b4ab = function(arg0, arg1) {
2132
- // Cast intrinsic for `Closure(Closure { dtor_idx: 366, function: Function { arguments: [Externref], shim_idx: 367, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2133
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h849099dfd9acf928, wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0);
2134
- return ret;
2135
- };
2136
2372
  imports.wbg.__wbindgen_cast_fac85390ef55bfaa = function(arg0, arg1) {
2137
2373
  // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2138
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h523d3e4e33cf7d1b, wasm_bindgen__convert__closures_____invoke__h7e1020caa6d4bdff);
2374
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1683131c23930486, wasm_bindgen__convert__closures_____invoke__h8d4b77242b184668);
2139
2375
  return ret;
2140
2376
  };
2141
2377
  imports.wbg.__wbindgen_init_externref_table = function() {
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "fabriciobracht <fabricio@bracht.dev>"
6
6
  ],
7
7
  "description": "MQTT v5.0 WebAssembly client and broker for browser environments",
8
- "version": "0.7.2",
8
+ "version": "0.8.1",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",