mqtt5-wasm 0.7.0 → 0.7.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/mqtt5_wasm.d.ts +110 -6
- package/mqtt5_wasm.js +78 -18
- package/mqtt5_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/mqtt5_wasm.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export class WasmBridgeConfig {
|
|
|
5
5
|
free(): void;
|
|
6
6
|
[Symbol.dispose](): void;
|
|
7
7
|
constructor(name: string);
|
|
8
|
+
/**
|
|
9
|
+
* # Errors
|
|
10
|
+
* Returns an error if the bridge configuration is invalid.
|
|
11
|
+
*/
|
|
8
12
|
validate(): void;
|
|
9
13
|
add_topic(mapping: WasmTopicMapping): void;
|
|
10
14
|
set password(value: string | null | undefined);
|
|
@@ -23,19 +27,47 @@ export enum WasmBridgeDirection {
|
|
|
23
27
|
export class WasmBroker {
|
|
24
28
|
free(): void;
|
|
25
29
|
[Symbol.dispose](): void;
|
|
30
|
+
/**
|
|
31
|
+
* # Errors
|
|
32
|
+
* Returns an error if the bridge cannot be added.
|
|
33
|
+
*/
|
|
26
34
|
add_bridge(config: WasmBridgeConfig, remote_port: MessagePort): Promise<void>;
|
|
27
35
|
list_roles(): Promise<string[]>;
|
|
28
36
|
role_count(): Promise<number>;
|
|
29
37
|
user_count(): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* # Errors
|
|
40
|
+
* Returns an error if the role does not exist.
|
|
41
|
+
*/
|
|
30
42
|
assign_role(username: string, role_name: string): Promise<void>;
|
|
31
43
|
clear_roles(): Promise<void>;
|
|
32
44
|
remove_role(name: string): Promise<boolean>;
|
|
33
45
|
remove_user(username: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* # Errors
|
|
48
|
+
* Returns an error if broker initialization fails.
|
|
49
|
+
*/
|
|
34
50
|
static with_config(wasm_config: WasmBrokerConfig): WasmBroker;
|
|
51
|
+
/**
|
|
52
|
+
* # Errors
|
|
53
|
+
* Returns an error if the permission string is invalid.
|
|
54
|
+
*/
|
|
35
55
|
add_acl_rule(username: string, topic_pattern: string, permission: string): Promise<void>;
|
|
36
56
|
list_bridges(): string[];
|
|
57
|
+
/**
|
|
58
|
+
* # Errors
|
|
59
|
+
* Returns an error if the permission string is invalid or role does not exist.
|
|
60
|
+
*/
|
|
37
61
|
add_role_rule(role_name: string, topic_pattern: string, permission: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* # Errors
|
|
64
|
+
* Returns an error if password hashing fails.
|
|
65
|
+
*/
|
|
38
66
|
static hash_password(password: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* # Errors
|
|
69
|
+
* Returns an error if the bridge cannot be removed.
|
|
70
|
+
*/
|
|
39
71
|
remove_bridge(name: string): Promise<void>;
|
|
40
72
|
unassign_role(username: string, role_name: string): Promise<boolean>;
|
|
41
73
|
acl_rule_count(): Promise<number>;
|
|
@@ -45,10 +77,22 @@ export class WasmBroker {
|
|
|
45
77
|
start_sys_topics(): void;
|
|
46
78
|
stop_all_bridges(): Promise<void>;
|
|
47
79
|
add_user_with_hash(username: string, password_hash: string): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* # Errors
|
|
82
|
+
* Returns an error if the `MessageChannel` cannot be created.
|
|
83
|
+
*/
|
|
48
84
|
create_client_port(): MessagePort;
|
|
49
85
|
start_sys_topics_with_interval_secs(interval_secs: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* # Errors
|
|
88
|
+
* Returns an error if broker initialization fails.
|
|
89
|
+
*/
|
|
50
90
|
constructor();
|
|
51
91
|
add_role(name: string): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* # Errors
|
|
94
|
+
* Returns an error if adding the user fails.
|
|
95
|
+
*/
|
|
52
96
|
add_user(username: string, password: string): Promise<void>;
|
|
53
97
|
has_user(username: string): Promise<boolean>;
|
|
54
98
|
}
|
|
@@ -117,26 +161,86 @@ export class WasmMessageProperties {
|
|
|
117
161
|
export class WasmMqttClient {
|
|
118
162
|
free(): void;
|
|
119
163
|
[Symbol.dispose](): void;
|
|
164
|
+
/**
|
|
165
|
+
* # Errors
|
|
166
|
+
* Returns an error if disconnect fails.
|
|
167
|
+
*/
|
|
120
168
|
disconnect(): Promise<void>;
|
|
121
169
|
on_connect(callback: Function): void;
|
|
170
|
+
/**
|
|
171
|
+
* # Errors
|
|
172
|
+
* Returns an error if not connected or unsubscribe fails.
|
|
173
|
+
*/
|
|
122
174
|
unsubscribe(topic: string): Promise<number>;
|
|
123
175
|
is_connected(): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* # Errors
|
|
178
|
+
* Returns an error if not connected or publish fails.
|
|
179
|
+
*/
|
|
124
180
|
publish_qos1(topic: string, payload: Uint8Array, callback: Function): Promise<number>;
|
|
181
|
+
/**
|
|
182
|
+
* # Errors
|
|
183
|
+
* Returns an error if not connected or publish fails.
|
|
184
|
+
*/
|
|
125
185
|
publish_qos2(topic: string, payload: Uint8Array, callback: Function): Promise<number>;
|
|
126
|
-
|
|
186
|
+
/**
|
|
187
|
+
* # Errors
|
|
188
|
+
* Returns an error if no auth method is set or send fails.
|
|
189
|
+
*/
|
|
190
|
+
respond_auth(auth_data: Uint8Array): void;
|
|
127
191
|
on_disconnect(callback: Function): void;
|
|
128
192
|
on_auth_challenge(callback: Function): void;
|
|
193
|
+
/**
|
|
194
|
+
* # Errors
|
|
195
|
+
* Returns an error if connection fails.
|
|
196
|
+
*/
|
|
129
197
|
connect_message_port(port: MessagePort): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* # Errors
|
|
200
|
+
* Returns an error if connection fails.
|
|
201
|
+
*/
|
|
130
202
|
connect_with_options(url: string, config: WasmConnectOptions): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* # Errors
|
|
205
|
+
* Returns an error if not connected or publish fails.
|
|
206
|
+
*/
|
|
131
207
|
publish_with_options(topic: string, payload: Uint8Array, options: WasmPublishOptions): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* # Errors
|
|
210
|
+
* Returns an error if not connected or subscribe fails.
|
|
211
|
+
*/
|
|
132
212
|
subscribe_with_options(topic: string, callback: Function, options: WasmSubscribeOptions): Promise<number>;
|
|
213
|
+
/**
|
|
214
|
+
* # Errors
|
|
215
|
+
* Returns an error if not connected or subscribe fails.
|
|
216
|
+
*/
|
|
133
217
|
subscribe_with_callback(topic: string, callback: Function): Promise<number>;
|
|
218
|
+
/**
|
|
219
|
+
* # Errors
|
|
220
|
+
* Returns an error if connection fails.
|
|
221
|
+
*/
|
|
134
222
|
connect_broadcast_channel(channel_name: string): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* # Errors
|
|
225
|
+
* Returns an error if connection fails.
|
|
226
|
+
*/
|
|
135
227
|
connect_message_port_with_options(port: MessagePort, config: WasmConnectOptions): Promise<void>;
|
|
136
228
|
constructor(client_id: string);
|
|
229
|
+
/**
|
|
230
|
+
* # Errors
|
|
231
|
+
* Returns an error if connection fails.
|
|
232
|
+
*/
|
|
137
233
|
connect(url: string): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* # Errors
|
|
236
|
+
* Returns an error if not connected or publish fails.
|
|
237
|
+
*/
|
|
138
238
|
publish(topic: string, payload: Uint8Array): Promise<void>;
|
|
139
239
|
on_error(callback: Function): void;
|
|
240
|
+
/**
|
|
241
|
+
* # Errors
|
|
242
|
+
* Returns an error if not connected or subscribe fails.
|
|
243
|
+
*/
|
|
140
244
|
subscribe(topic: string): Promise<number>;
|
|
141
245
|
}
|
|
142
246
|
|
|
@@ -313,7 +417,7 @@ export interface InitOutput {
|
|
|
313
417
|
readonly wasmmqttclient_publish_qos1: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
314
418
|
readonly wasmmqttclient_publish_qos2: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
315
419
|
readonly wasmmqttclient_publish_with_options: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
316
|
-
readonly wasmmqttclient_respond_auth: (a: number, b: number, c: number) =>
|
|
420
|
+
readonly wasmmqttclient_respond_auth: (a: number, b: number, c: number) => [number, number];
|
|
317
421
|
readonly wasmmqttclient_subscribe: (a: number, b: number, c: number) => any;
|
|
318
422
|
readonly wasmmqttclient_subscribe_with_callback: (a: number, b: number, c: number, d: any) => any;
|
|
319
423
|
readonly wasmmqttclient_subscribe_with_options: (a: number, b: number, c: number, d: any, e: number) => any;
|
|
@@ -366,12 +470,12 @@ export interface InitOutput {
|
|
|
366
470
|
readonly wasmwillmessage_set_willDelayInterval: (a: number, b: number) => void;
|
|
367
471
|
readonly wasmwillmessage_topic: (a: number) => [number, number];
|
|
368
472
|
readonly wasmwillmessage_willDelayInterval: (a: number) => number;
|
|
369
|
-
readonly wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0: (a: number, b: number, c: any) => void;
|
|
370
|
-
readonly wasm_bindgen__closure__destroy__h849099dfd9acf928: (a: number, b: number) => void;
|
|
371
|
-
readonly wasm_bindgen__convert__closures_____invoke__h083737b2f77d415a: (a: number, b: number, c: any) => void;
|
|
372
|
-
readonly wasm_bindgen__closure__destroy__h25acc308bc5379fe: (a: number, b: number) => void;
|
|
373
473
|
readonly wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b: (a: number, b: number) => void;
|
|
374
474
|
readonly wasm_bindgen__closure__destroy__he9d43d9a42a0e056: (a: number, b: number) => void;
|
|
475
|
+
readonly wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0: (a: number, b: number, c: any) => void;
|
|
476
|
+
readonly wasm_bindgen__closure__destroy__h849099dfd9acf928: (a: number, b: number) => void;
|
|
477
|
+
readonly wasm_bindgen__convert__closures_____invoke__h062394b5bffa0095: (a: number, b: number, c: any) => void;
|
|
478
|
+
readonly wasm_bindgen__closure__destroy__h16c2392199b99db1: (a: number, b: number) => void;
|
|
375
479
|
readonly wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf: (a: number, b: number, c: any, d: any) => void;
|
|
376
480
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
377
481
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
package/mqtt5_wasm.js
CHANGED
|
@@ -251,16 +251,16 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
251
251
|
|
|
252
252
|
let WASM_VECTOR_LEN = 0;
|
|
253
253
|
|
|
254
|
-
function
|
|
255
|
-
wasm.
|
|
254
|
+
function wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b(arg0, arg1) {
|
|
255
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b(arg0, arg1);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
function
|
|
259
|
-
wasm.
|
|
258
|
+
function wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(arg0, arg1, arg2) {
|
|
259
|
+
wasm.wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0(arg0, arg1, arg2);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
function
|
|
263
|
-
wasm.
|
|
262
|
+
function wasm_bindgen__convert__closures_____invoke__h062394b5bffa0095(arg0, arg1, arg2) {
|
|
263
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h062394b5bffa0095(arg0, arg1, arg2);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
function wasm_bindgen__convert__closures_____invoke__h1ee277075b103ebf(arg0, arg1, arg2, arg3) {
|
|
@@ -367,6 +367,10 @@ export class WasmBridgeConfig {
|
|
|
367
367
|
WasmBridgeConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
368
368
|
return this;
|
|
369
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* # Errors
|
|
372
|
+
* Returns an error if the bridge configuration is invalid.
|
|
373
|
+
*/
|
|
370
374
|
validate() {
|
|
371
375
|
const ret = wasm.wasmbridgeconfig_validate(this.__wbg_ptr);
|
|
372
376
|
if (ret[1]) {
|
|
@@ -412,6 +416,8 @@ export class WasmBroker {
|
|
|
412
416
|
wasm.__wbg_wasmbroker_free(ptr, 0);
|
|
413
417
|
}
|
|
414
418
|
/**
|
|
419
|
+
* # Errors
|
|
420
|
+
* Returns an error if the bridge cannot be added.
|
|
415
421
|
* @param {WasmBridgeConfig} config
|
|
416
422
|
* @param {MessagePort} remote_port
|
|
417
423
|
* @returns {Promise<void>}
|
|
@@ -444,6 +450,8 @@ export class WasmBroker {
|
|
|
444
450
|
return ret;
|
|
445
451
|
}
|
|
446
452
|
/**
|
|
453
|
+
* # Errors
|
|
454
|
+
* Returns an error if the role does not exist.
|
|
447
455
|
* @param {string} username
|
|
448
456
|
* @param {string} role_name
|
|
449
457
|
* @returns {Promise<void>}
|
|
@@ -484,6 +492,8 @@ export class WasmBroker {
|
|
|
484
492
|
return ret;
|
|
485
493
|
}
|
|
486
494
|
/**
|
|
495
|
+
* # Errors
|
|
496
|
+
* Returns an error if broker initialization fails.
|
|
487
497
|
* @param {WasmBrokerConfig} wasm_config
|
|
488
498
|
* @returns {WasmBroker}
|
|
489
499
|
*/
|
|
@@ -497,6 +507,8 @@ export class WasmBroker {
|
|
|
497
507
|
return WasmBroker.__wrap(ret[0]);
|
|
498
508
|
}
|
|
499
509
|
/**
|
|
510
|
+
* # Errors
|
|
511
|
+
* Returns an error if the permission string is invalid.
|
|
500
512
|
* @param {string} username
|
|
501
513
|
* @param {string} topic_pattern
|
|
502
514
|
* @param {string} permission
|
|
@@ -522,6 +534,8 @@ export class WasmBroker {
|
|
|
522
534
|
return v1;
|
|
523
535
|
}
|
|
524
536
|
/**
|
|
537
|
+
* # Errors
|
|
538
|
+
* Returns an error if the permission string is invalid or role does not exist.
|
|
525
539
|
* @param {string} role_name
|
|
526
540
|
* @param {string} topic_pattern
|
|
527
541
|
* @param {string} permission
|
|
@@ -538,6 +552,8 @@ export class WasmBroker {
|
|
|
538
552
|
return ret;
|
|
539
553
|
}
|
|
540
554
|
/**
|
|
555
|
+
* # Errors
|
|
556
|
+
* Returns an error if password hashing fails.
|
|
541
557
|
* @param {string} password
|
|
542
558
|
* @returns {string}
|
|
543
559
|
*/
|
|
@@ -562,6 +578,8 @@ export class WasmBroker {
|
|
|
562
578
|
}
|
|
563
579
|
}
|
|
564
580
|
/**
|
|
581
|
+
* # Errors
|
|
582
|
+
* Returns an error if the bridge cannot be removed.
|
|
565
583
|
* @param {string} name
|
|
566
584
|
* @returns {Promise<void>}
|
|
567
585
|
*/
|
|
@@ -635,6 +653,8 @@ export class WasmBroker {
|
|
|
635
653
|
return ret;
|
|
636
654
|
}
|
|
637
655
|
/**
|
|
656
|
+
* # Errors
|
|
657
|
+
* Returns an error if the `MessageChannel` cannot be created.
|
|
638
658
|
* @returns {MessagePort}
|
|
639
659
|
*/
|
|
640
660
|
create_client_port() {
|
|
@@ -650,6 +670,10 @@ export class WasmBroker {
|
|
|
650
670
|
start_sys_topics_with_interval_secs(interval_secs) {
|
|
651
671
|
wasm.wasmbroker_start_sys_topics_with_interval_secs(this.__wbg_ptr, interval_secs);
|
|
652
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* # Errors
|
|
675
|
+
* Returns an error if broker initialization fails.
|
|
676
|
+
*/
|
|
653
677
|
constructor() {
|
|
654
678
|
const ret = wasm.wasmbroker_new();
|
|
655
679
|
if (ret[2]) {
|
|
@@ -670,6 +694,8 @@ export class WasmBroker {
|
|
|
670
694
|
return ret;
|
|
671
695
|
}
|
|
672
696
|
/**
|
|
697
|
+
* # Errors
|
|
698
|
+
* Returns an error if adding the user fails.
|
|
673
699
|
* @param {string} username
|
|
674
700
|
* @param {string} password
|
|
675
701
|
* @returns {Promise<void>}
|
|
@@ -1098,6 +1124,8 @@ export class WasmMqttClient {
|
|
|
1098
1124
|
wasm.__wbg_wasmmqttclient_free(ptr, 0);
|
|
1099
1125
|
}
|
|
1100
1126
|
/**
|
|
1127
|
+
* # Errors
|
|
1128
|
+
* Returns an error if disconnect fails.
|
|
1101
1129
|
* @returns {Promise<void>}
|
|
1102
1130
|
*/
|
|
1103
1131
|
disconnect() {
|
|
@@ -1111,6 +1139,8 @@ export class WasmMqttClient {
|
|
|
1111
1139
|
wasm.wasmmqttclient_on_connect(this.__wbg_ptr, callback);
|
|
1112
1140
|
}
|
|
1113
1141
|
/**
|
|
1142
|
+
* # Errors
|
|
1143
|
+
* Returns an error if not connected or unsubscribe fails.
|
|
1114
1144
|
* @param {string} topic
|
|
1115
1145
|
* @returns {Promise<number>}
|
|
1116
1146
|
*/
|
|
@@ -1128,6 +1158,8 @@ export class WasmMqttClient {
|
|
|
1128
1158
|
return ret !== 0;
|
|
1129
1159
|
}
|
|
1130
1160
|
/**
|
|
1161
|
+
* # Errors
|
|
1162
|
+
* Returns an error if not connected or publish fails.
|
|
1131
1163
|
* @param {string} topic
|
|
1132
1164
|
* @param {Uint8Array} payload
|
|
1133
1165
|
* @param {Function} callback
|
|
@@ -1142,6 +1174,8 @@ export class WasmMqttClient {
|
|
|
1142
1174
|
return ret;
|
|
1143
1175
|
}
|
|
1144
1176
|
/**
|
|
1177
|
+
* # Errors
|
|
1178
|
+
* Returns an error if not connected or publish fails.
|
|
1145
1179
|
* @param {string} topic
|
|
1146
1180
|
* @param {Uint8Array} payload
|
|
1147
1181
|
* @param {Function} callback
|
|
@@ -1156,14 +1190,17 @@ export class WasmMqttClient {
|
|
|
1156
1190
|
return ret;
|
|
1157
1191
|
}
|
|
1158
1192
|
/**
|
|
1193
|
+
* # Errors
|
|
1194
|
+
* Returns an error if no auth method is set or send fails.
|
|
1159
1195
|
* @param {Uint8Array} auth_data
|
|
1160
|
-
* @returns {Promise<void>}
|
|
1161
1196
|
*/
|
|
1162
1197
|
respond_auth(auth_data) {
|
|
1163
1198
|
const ptr0 = passArray8ToWasm0(auth_data, wasm.__wbindgen_malloc);
|
|
1164
1199
|
const len0 = WASM_VECTOR_LEN;
|
|
1165
1200
|
const ret = wasm.wasmmqttclient_respond_auth(this.__wbg_ptr, ptr0, len0);
|
|
1166
|
-
|
|
1201
|
+
if (ret[1]) {
|
|
1202
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1203
|
+
}
|
|
1167
1204
|
}
|
|
1168
1205
|
/**
|
|
1169
1206
|
* @param {Function} callback
|
|
@@ -1178,6 +1215,8 @@ export class WasmMqttClient {
|
|
|
1178
1215
|
wasm.wasmmqttclient_on_auth_challenge(this.__wbg_ptr, callback);
|
|
1179
1216
|
}
|
|
1180
1217
|
/**
|
|
1218
|
+
* # Errors
|
|
1219
|
+
* Returns an error if connection fails.
|
|
1181
1220
|
* @param {MessagePort} port
|
|
1182
1221
|
* @returns {Promise<void>}
|
|
1183
1222
|
*/
|
|
@@ -1186,6 +1225,8 @@ export class WasmMqttClient {
|
|
|
1186
1225
|
return ret;
|
|
1187
1226
|
}
|
|
1188
1227
|
/**
|
|
1228
|
+
* # Errors
|
|
1229
|
+
* Returns an error if connection fails.
|
|
1189
1230
|
* @param {string} url
|
|
1190
1231
|
* @param {WasmConnectOptions} config
|
|
1191
1232
|
* @returns {Promise<void>}
|
|
@@ -1198,6 +1239,8 @@ export class WasmMqttClient {
|
|
|
1198
1239
|
return ret;
|
|
1199
1240
|
}
|
|
1200
1241
|
/**
|
|
1242
|
+
* # Errors
|
|
1243
|
+
* Returns an error if not connected or publish fails.
|
|
1201
1244
|
* @param {string} topic
|
|
1202
1245
|
* @param {Uint8Array} payload
|
|
1203
1246
|
* @param {WasmPublishOptions} options
|
|
@@ -1213,6 +1256,8 @@ export class WasmMqttClient {
|
|
|
1213
1256
|
return ret;
|
|
1214
1257
|
}
|
|
1215
1258
|
/**
|
|
1259
|
+
* # Errors
|
|
1260
|
+
* Returns an error if not connected or subscribe fails.
|
|
1216
1261
|
* @param {string} topic
|
|
1217
1262
|
* @param {Function} callback
|
|
1218
1263
|
* @param {WasmSubscribeOptions} options
|
|
@@ -1226,6 +1271,8 @@ export class WasmMqttClient {
|
|
|
1226
1271
|
return ret;
|
|
1227
1272
|
}
|
|
1228
1273
|
/**
|
|
1274
|
+
* # Errors
|
|
1275
|
+
* Returns an error if not connected or subscribe fails.
|
|
1229
1276
|
* @param {string} topic
|
|
1230
1277
|
* @param {Function} callback
|
|
1231
1278
|
* @returns {Promise<number>}
|
|
@@ -1237,6 +1284,8 @@ export class WasmMqttClient {
|
|
|
1237
1284
|
return ret;
|
|
1238
1285
|
}
|
|
1239
1286
|
/**
|
|
1287
|
+
* # Errors
|
|
1288
|
+
* Returns an error if connection fails.
|
|
1240
1289
|
* @param {string} channel_name
|
|
1241
1290
|
* @returns {Promise<void>}
|
|
1242
1291
|
*/
|
|
@@ -1247,6 +1296,8 @@ export class WasmMqttClient {
|
|
|
1247
1296
|
return ret;
|
|
1248
1297
|
}
|
|
1249
1298
|
/**
|
|
1299
|
+
* # Errors
|
|
1300
|
+
* Returns an error if connection fails.
|
|
1250
1301
|
* @param {MessagePort} port
|
|
1251
1302
|
* @param {WasmConnectOptions} config
|
|
1252
1303
|
* @returns {Promise<void>}
|
|
@@ -1268,6 +1319,8 @@ export class WasmMqttClient {
|
|
|
1268
1319
|
return this;
|
|
1269
1320
|
}
|
|
1270
1321
|
/**
|
|
1322
|
+
* # Errors
|
|
1323
|
+
* Returns an error if connection fails.
|
|
1271
1324
|
* @param {string} url
|
|
1272
1325
|
* @returns {Promise<void>}
|
|
1273
1326
|
*/
|
|
@@ -1278,6 +1331,8 @@ export class WasmMqttClient {
|
|
|
1278
1331
|
return ret;
|
|
1279
1332
|
}
|
|
1280
1333
|
/**
|
|
1334
|
+
* # Errors
|
|
1335
|
+
* Returns an error if not connected or publish fails.
|
|
1281
1336
|
* @param {string} topic
|
|
1282
1337
|
* @param {Uint8Array} payload
|
|
1283
1338
|
* @returns {Promise<void>}
|
|
@@ -1297,6 +1352,8 @@ export class WasmMqttClient {
|
|
|
1297
1352
|
wasm.wasmmqttclient_on_error(this.__wbg_ptr, callback);
|
|
1298
1353
|
}
|
|
1299
1354
|
/**
|
|
1355
|
+
* # Errors
|
|
1356
|
+
* Returns an error if not connected or subscribe fails.
|
|
1300
1357
|
* @param {string} topic
|
|
1301
1358
|
* @returns {Promise<number>}
|
|
1302
1359
|
*/
|
|
@@ -1788,6 +1845,9 @@ function __wbg_get_imports() {
|
|
|
1788
1845
|
imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
|
|
1789
1846
|
arg0._wbg_cb_unref();
|
|
1790
1847
|
};
|
|
1848
|
+
imports.wbg.__wbg_addEventListener_6a82629b3d430a48 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1849
|
+
arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
|
|
1850
|
+
}, arguments) };
|
|
1791
1851
|
imports.wbg.__wbg_buffer_6cb2fecb1f253d71 = function(arg0) {
|
|
1792
1852
|
const ret = arg0.buffer;
|
|
1793
1853
|
return ret;
|
|
@@ -2048,24 +2108,19 @@ function __wbg_get_imports() {
|
|
|
2048
2108
|
const ret = v0;
|
|
2049
2109
|
return ret;
|
|
2050
2110
|
};
|
|
2051
|
-
imports.wbg.
|
|
2052
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
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`.
|
|
2053
2113
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he9d43d9a42a0e056, wasm_bindgen__convert__closures_____invoke__hf9723d0014506a5b);
|
|
2054
2114
|
return ret;
|
|
2055
2115
|
};
|
|
2056
|
-
imports.wbg.__wbindgen_cast_663c73182bf372f2 = function(arg0, arg1) {
|
|
2057
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 369, function: Function { arguments: [Externref], shim_idx: 370, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2058
|
-
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h849099dfd9acf928, wasm_bindgen__convert__closures_____invoke__ha9d3e198cd0951b0);
|
|
2059
|
-
return ret;
|
|
2060
|
-
};
|
|
2061
2116
|
imports.wbg.__wbindgen_cast_a6d58121ace2ceaa = function(arg0, arg1) {
|
|
2062
2117
|
// 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`.
|
|
2063
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2118
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h16c2392199b99db1, wasm_bindgen__convert__closures_____invoke__h062394b5bffa0095);
|
|
2064
2119
|
return ret;
|
|
2065
2120
|
};
|
|
2066
2121
|
imports.wbg.__wbindgen_cast_d3f7166d7f91ad34 = function(arg0, arg1) {
|
|
2067
2122
|
// 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`.
|
|
2068
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2123
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h16c2392199b99db1, wasm_bindgen__convert__closures_____invoke__h062394b5bffa0095);
|
|
2069
2124
|
return ret;
|
|
2070
2125
|
};
|
|
2071
2126
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
@@ -2073,9 +2128,14 @@ function __wbg_get_imports() {
|
|
|
2073
2128
|
const ret = arg0;
|
|
2074
2129
|
return ret;
|
|
2075
2130
|
};
|
|
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
|
+
};
|
|
2076
2136
|
imports.wbg.__wbindgen_cast_fac85390ef55bfaa = function(arg0, arg1) {
|
|
2077
2137
|
// 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`.
|
|
2078
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2138
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h16c2392199b99db1, wasm_bindgen__convert__closures_____invoke__h062394b5bffa0095);
|
|
2079
2139
|
return ret;
|
|
2080
2140
|
};
|
|
2081
2141
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
package/mqtt5_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED