mqtt-json-rpc 2.0.0 → 2.1.0
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 +6 -5
- package/dst/mqtt-json-rpc.cjs.js +5930 -0
- package/dst/mqtt-json-rpc.d.ts +33 -0
- package/dst/mqtt-json-rpc.esm.js +5931 -0
- package/dst/mqtt-json-rpc.js +287 -0
- package/dst/mqtt-json-rpc.umd.js +10 -0
- package/etc/eslint.mts +129 -0
- package/etc/stx.conf +29 -0
- package/etc/tsc.json +27 -0
- package/etc/tsc.tsbuildinfo +1 -0
- package/etc/vite.mts +45 -0
- package/package.json +45 -27
- package/sample/package.json +9 -10
- package/sample/sample.js +19 -25
- package/sample/sample.ts +34 -0
- package/sample/tsc.json +26 -0
- package/sample/tsc.tsbuildinfo +1 -0
- package/sample/vite.mjs +36 -0
- package/src/mqtt-json-rpc.ts +337 -0
- package/eslint.yaml +0 -66
- package/mqtt-json-rpc.d.ts +0 -54
- package/mqtt-json-rpc.js +0 -282
- package/sample/Gruntfile.js +0 -33
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ corresponding [TypeScript definition](mqtt-json-rpc.d.ts)) file):
|
|
|
81
81
|
be a valid MQTT topic name. The method returns `true` if `method` is
|
|
82
82
|
already registered, else it returns `false`.
|
|
83
83
|
|
|
84
|
-
- `MQTT-JSON-RPC#register(method: string, callback: (...args: any[]) => any): Promise
|
|
84
|
+
- `MQTT-JSON-RPC#register(method: string, callback: (...args: any[]) => any): Promise<boolean>`:<br/>
|
|
85
85
|
Register a method. The `method` has to be a valid MQTT topic
|
|
86
86
|
name. The `callback` is called with the `params` passed to
|
|
87
87
|
the remote `MQTT-JSON-RPC#notify()` or `MQTT-JSON-RPC#call()`. For
|
|
@@ -91,7 +91,7 @@ corresponding [TypeScript definition](mqtt-json-rpc.d.ts)) file):
|
|
|
91
91
|
Internally, on the MQTT broker the topic `${method}/request` is
|
|
92
92
|
subscribed.
|
|
93
93
|
|
|
94
|
-
- `MQTT-JSON-RPC#unregister(method: string): Promise
|
|
94
|
+
- `MQTT-JSON-RPC#unregister(method: string): Promise<void>`:<br/>
|
|
95
95
|
Unregister a previously registered method.
|
|
96
96
|
Internally, on the MQTT broker the topic `${method}/request` is unsubscribed.
|
|
97
97
|
|
|
@@ -99,7 +99,7 @@ corresponding [TypeScript definition](mqtt-json-rpc.d.ts)) file):
|
|
|
99
99
|
Notify a method. The remote `MQTT-JSON-RPC#register()` `callback` is called
|
|
100
100
|
with `params` and its return value is silently ignored.
|
|
101
101
|
|
|
102
|
-
- `MQTT-JSON-RPC#call(method: string, ...params: any[]): Promise
|
|
102
|
+
- `MQTT-JSON-RPC#call(method: string, ...params: any[]): Promise<any>`:<br/>
|
|
103
103
|
Call a method. The remote `MQTT-JSON-RPC#register()` `callback` is
|
|
104
104
|
called with `params` and its return value resolves the returned
|
|
105
105
|
`Promise`. If the remote `callback` throws an exception, this rejects
|
|
@@ -154,9 +154,10 @@ message to the temporary (client-specific) MQTT topic
|
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
The JSON-RPC 2.0 `id` field always consists of `<cid>:<rid>`, where
|
|
157
|
-
`<cid>` is the UUID v1 of the MQTT-JSON-RPC instance and `<rid>` is
|
|
157
|
+
`<cid>` is the UUID v1 of the MQTT-JSON-RPC client instance and `<rid>` is
|
|
158
158
|
the UUID v1 of the particular method request. The `<cid>` is used for
|
|
159
159
|
sending back the JSON-RPC 2.0 response message to the requestor only.
|
|
160
|
+
The `<rid>` is used for correlating the response to the request only.
|
|
160
161
|
|
|
161
162
|
Example
|
|
162
163
|
-------
|
|
@@ -249,7 +250,7 @@ CLOSE
|
|
|
249
250
|
License
|
|
250
251
|
-------
|
|
251
252
|
|
|
252
|
-
Copyright (c) 2018-
|
|
253
|
+
Copyright (c) 2018-2025 Dr. Ralf S. Engelschall (http://engelschall.com/)
|
|
253
254
|
|
|
254
255
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
255
256
|
a copy of this software and associated documentation files (the
|