fostrom 0.0.2 → 0.0.3
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/config.js +4 -2
- package/index.js +4 -4
- package/mqtt.js +5 -3
- package/package.json +16 -5
package/config.js
CHANGED
|
@@ -94,9 +94,9 @@ function get_connect_urls(config) {
|
|
|
94
94
|
return { tcp_url, ws_url }
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/*
|
|
97
|
+
/* Get Config */
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
function get_config(config) {
|
|
100
100
|
const { tcp_url, ws_url } = get_connect_urls(config)
|
|
101
101
|
|
|
102
102
|
return {
|
|
@@ -113,3 +113,5 @@ export function get_config(config) {
|
|
|
113
113
|
ws_url: ws_url
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
|
|
117
|
+
module.exports = { get_config }
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const { pack } = require('msgpackr')
|
|
2
|
+
const { get_config } = require('./config.js')
|
|
3
|
+
const { start } = require('./mqtt.js')
|
|
4
4
|
|
|
5
5
|
class Fostrom {
|
|
6
6
|
constructor(config) {
|
|
@@ -27,4 +27,4 @@ class Fostrom {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
module.exports = Fostrom
|
package/mqtt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const mqtt = require('mqtt')
|
|
2
|
+
const { unpack, pack } = require('msgpackr')
|
|
3
3
|
|
|
4
4
|
const invalid_device_creds_error = new Error(
|
|
5
5
|
'Invalid Device Credentials. Please re-check the device credentials.'
|
|
@@ -122,9 +122,11 @@ function attachHooks(instance, config, client) {
|
|
|
122
122
|
})
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
async function start(instance, config) {
|
|
126
126
|
let client = await connect(config)
|
|
127
127
|
attachHooks(instance, config, client)
|
|
128
128
|
if (await subscribe(config, client)) { config.callbacks.connected() }
|
|
129
129
|
return client
|
|
130
130
|
}
|
|
131
|
+
|
|
132
|
+
module.exports = { start }
|
package/package.json
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fostrom",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Fostrom's Official Device SDK for JS. Fostrom is an IoT Cloud Platform. Check it out on fostrom.io",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fostrom",
|
|
7
|
+
"device",
|
|
8
|
+
"sdk",
|
|
9
|
+
"iot",
|
|
10
|
+
"cloud",
|
|
11
|
+
"fleet",
|
|
12
|
+
"mqtt",
|
|
13
|
+
"websockets"
|
|
14
|
+
],
|
|
6
15
|
"homepage": "https://docs.fostrom.io/libs/js",
|
|
7
16
|
"license": "MIT",
|
|
8
17
|
"author": "Fostrom <support@fostrom.io> (https://fostrom.io)",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"mqtt.js",
|
|
21
|
+
"config.js"
|
|
22
|
+
],
|
|
12
23
|
"dependencies": {
|
|
13
24
|
"mqtt": "^5.5.0",
|
|
14
25
|
"msgpackr": "^1.10.1"
|