fostrom 0.0.1 → 0.0.2
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/mqtt.js +2 -2
- package/package.json +3 -16
package/mqtt.js
CHANGED
|
@@ -5,7 +5,7 @@ const invalid_device_creds_error = new Error(
|
|
|
5
5
|
'Invalid Device Credentials. Please re-check the device credentials.'
|
|
6
6
|
)
|
|
7
7
|
|
|
8
|
-
const network_error_msg = `[Fostrom] Failed to connect to Fostrom. Retrying in ${Math.round(retry_interval / 1000)} seconds...`
|
|
8
|
+
const network_error_msg = retry_interval => `[Fostrom] Failed to connect to Fostrom. Retrying in ${Math.round(retry_interval / 1000)} seconds...`
|
|
9
9
|
|
|
10
10
|
function sleep(ms) {
|
|
11
11
|
return new Promise(resolve => setTimeout(resolve, ms))
|
|
@@ -68,7 +68,7 @@ async function connect(config, retry_count = 0, retry_interval = 3000) {
|
|
|
68
68
|
if (client_or_error == 'unauthorized') {
|
|
69
69
|
config.callbacks.fatal_error(invalid_device_creds_error)
|
|
70
70
|
} else if (client_or_error == 'network_error') {
|
|
71
|
-
console.error(network_error_msg)
|
|
71
|
+
console.error(network_error_msg(retry_interval))
|
|
72
72
|
await sleep(retry_interval)
|
|
73
73
|
retry_count = retry_count + 1
|
|
74
74
|
retry_interval = retry_count <= 3 ? retry_interval : backoff(retry_interval)
|
package/package.json
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fostrom",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Fostrom's Official Device SDK for JS. Fostrom is an IoT Cloud Platform. Check it out on fostrom.io",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"fostrom",
|
|
7
|
-
"device",
|
|
8
|
-
"sdk",
|
|
9
|
-
"iot",
|
|
10
|
-
"cloud",
|
|
11
|
-
"fleet",
|
|
12
|
-
"mqtt",
|
|
13
|
-
"websockets"
|
|
14
|
-
],
|
|
5
|
+
"keywords": ["fostrom", "device", "sdk", "iot", "cloud", "fleet", "mqtt", "websockets"],
|
|
15
6
|
"homepage": "https://docs.fostrom.io/libs/js",
|
|
16
7
|
"license": "MIT",
|
|
17
8
|
"author": "Fostrom <support@fostrom.io> (https://fostrom.io)",
|
|
18
9
|
"main": "index.js",
|
|
19
10
|
"type": "module",
|
|
20
|
-
"files": [
|
|
21
|
-
"index.js",
|
|
22
|
-
"mqtt.js",
|
|
23
|
-
"config.js"
|
|
24
|
-
],
|
|
11
|
+
"files": ["index.js", "mqtt.js", "config.js"],
|
|
25
12
|
"dependencies": {
|
|
26
13
|
"mqtt": "^5.5.0",
|
|
27
14
|
"msgpackr": "^1.10.1"
|