mqtt-json-rpc 1.3.0 → 1.3.4

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
@@ -199,7 +199,7 @@ topic readwrite example/#
199
199
  example:$6$awYNe6oCAi+xlvo5$mWIUqyy4I0O3nJ99lP1mkRVqsDGymF8en5NChQQxf7KrVJLUp1SzrrVDe94wWWJa3JGIbOXD9wfFGZdi948e6A==
200
200
  ```
201
201
 
202
- Then test-drive MQTT-JSON-RPC with a complete [sample](sample.js) to see
202
+ Then test-drive MQTT-JSON-RPC with a complete [sample](sample/sample.js) to see
203
203
  MQTT-JSON-RPC in action and tracing its communication:
204
204
 
205
205
  ```js
@@ -221,7 +221,7 @@ rpc.on("reconnect", () => { console.log("RECONNECT") })
221
221
  rpc.on("message", (topic, message) => { console.log("RECEIVED", topic, message.toString()) })
222
222
 
223
223
  rpc.on("connect", () => {
224
- console.log("CONNECTED")
224
+ console.log("CONNECT")
225
225
  rpc.register("example/hello", (a1, a2) => {
226
226
  console.log("example/hello: request: ", a1, a2)
227
227
  return `${a1}:${a2}`
@@ -239,7 +239,7 @@ The output will be:
239
239
 
240
240
  ```
241
241
  $ node sample.js
242
- CONNECTED
242
+ CONNECT
243
243
  RECEIVED example/hello/request {"jsonrpc":"2.0","id":"1099cb50-bd2b-11eb-8198-43568ad728c4:10bf7bc0-bd2b-11eb-bac6-439c565b651a","method":"example/hello","params":["world",42]}
244
244
  example/hello: request: world 42
245
245
  RECEIVED example/hello/response/1099cb50-bd2b-11eb-8198-43568ad728c4 {"jsonrpc":"2.0","id":"1099cb50-bd2b-11eb-8198-43568ad728c4:10bf7bc0-bd2b-11eb-bac6-439c565b651a","result":"world:42"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mqtt-json-rpc",
3
- "version": "1.3.0",
3
+ "version": "1.3.4",
4
4
  "description": "JSON-RPC protocol over MQTT communication",
5
5
  "keywords": [ "json-rpc", "json", "rpc", "mqtt" ],
6
6
  "main": "./mqtt-json-rpc.js",
@@ -18,25 +18,24 @@
18
18
  "bugs": "https://github.com/rse/mqtt-json-rpc/issues",
19
19
  "devDependencies": {
20
20
  "babel-eslint": "10.1.0",
21
- "eslint": "7.27.0",
21
+ "eslint": "7.32.0",
22
22
  "eslint-config-standard": "16.0.3",
23
- "eslint-plugin-promise": "4.2.1",
24
- "eslint-plugin-import": "2.23.3",
23
+ "eslint-plugin-import": "2.25.2",
25
24
  "eslint-plugin-node": "11.1.0",
26
- "mqtt": "4.2.6"
25
+ "mqtt": "4.2.8"
27
26
  },
28
27
  "peerDependencies": {
29
- "mqtt": ">=3.0.0"
28
+ "mqtt": ">=4.0.0"
30
29
  },
31
30
  "dependencies": {
32
31
  "pure-uuid": "1.6.2",
33
- "encodr": "1.2.5",
32
+ "encodr": "1.3.1",
34
33
  "jsonrpc-lite": "2.2.0"
35
34
  },
36
35
  "engines": {
37
- "node": ">=10.0.0"
36
+ "node": ">=12.0.0"
38
37
  },
39
38
  "scripts": {
40
- "prepublishOnly": "eslint --config eslint.yaml mqtt-json-rpc.js sample.js"
39
+ "prepublishOnly": "eslint --config eslint.yaml mqtt-json-rpc.js sample/sample.js"
41
40
  }
42
41
  }
@@ -0,0 +1,33 @@
1
+
2
+ module.exports = function (grunt) {
3
+ grunt.loadNpmTasks("grunt-browserify")
4
+ grunt.initConfig({
5
+ browserify: {
6
+ "sample": {
7
+ files: {
8
+ "sample.bundle.js": [ "./sample.js" ]
9
+ },
10
+ options: {
11
+ transform: [
12
+ [ "babelify", {
13
+ presets: [
14
+ [ "@babel/preset-env", {
15
+ "targets": {
16
+ "browsers": "last 2 versions, > 1%, ie 11"
17
+ }
18
+ } ]
19
+ ]
20
+ } ],
21
+ // "aliasify"
22
+ ],
23
+ browserifyOptions: {
24
+ standalone: "Sample",
25
+ debug: false
26
+ }
27
+ }
28
+ }
29
+ }
30
+ })
31
+ grunt.registerTask("default", [ "browserify" ])
32
+ }
33
+
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "sample",
3
+ "version": "0.0.0",
4
+ "description": "",
5
+ "dependencies": {
6
+ "@babel/core": "7.15.0",
7
+ "mqtt": "4.2.8",
8
+ "mqtt-json-rpc": ".."
9
+ },
10
+ "devDependencies": {
11
+ "grunt": "1.4.1",
12
+ "grunt-cli": "1.4.3",
13
+ "grunt-browserify": "6.0.0",
14
+ "browserify": "17.0.0",
15
+ "babelify": "10.0.0",
16
+ "@babel/preset-env": "7.15.0"
17
+ },
18
+ "scripts": {
19
+ "build": "grunt default",
20
+ "start": "node sample.js",
21
+ "start:browser": "open sample.html",
22
+ "clean": "rimraf node_modules sample.bundle.js"
23
+ }
24
+ }
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+ <title>Sample</title>
6
+ <script src="sample.bundle.js" type="text/javascript"></script>
7
+ </head>
8
+ <body>
9
+ Please watch the console!
10
+ </body>
11
+ </html>
@@ -1,6 +1,6 @@
1
1
 
2
2
  const MQTT = require("mqtt")
3
- const RPC = require("./mqtt-json-rpc")
3
+ const RPC = require("mqtt-json-rpc")
4
4
 
5
5
  const mqtt = MQTT.connect("wss://127.0.0.1:8889", {
6
6
  rejectUnauthorized: false,
@@ -17,7 +17,7 @@ rpc.on("reconnect", () => { console.log("RECONNECT") })
17
17
  rpc.on("message", (topic, message) => { console.log("RECEIVED", topic, message.toString()) })
18
18
 
19
19
  rpc.on("connect", () => {
20
- console.log("CONNECTED")
20
+ console.log("CONNECT")
21
21
  rpc.register("example/hello", (a1, a2) => {
22
22
  console.log("example/hello: request: ", a1, a2)
23
23
  return `${a1}:${a2}`