You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
IoT Protocol is a protocol over TCP based on HTTP for light data traffic.
4
4
5
+
**Motivation**: HTTP 1.1 (*http://*) request minimum size is 26 bytes (https://stackoverflow.com/a/25065027/1956719) and the HOST param is mandatory for all requests.
6
+
7
+
The IOT_PROTOCOL (*iot://*) request minimum size is 8 bytes withless to require HOST param for requests.
8
+
5
9
## Preamble Version 1
6
10
7
11
```js
@@ -16,8 +20,9 @@ PATH\n
16
20
17
21
Version is the version of iot protocol. Used for compatibility.
18
22
19
-
- Type: `byte` | `uint8_t`. **REQUIRED**
20
-
- Example: `1`
23
+
* Type: `byte` | `uint8_t`. **REQUIRED**
24
+
* Size: 1 byte
25
+
* Example: `1`
21
26
22
27
### METHOD_ID
23
28
@@ -26,28 +31,29 @@ Method ID: METHOD+ID.
26
31
Methods:
27
32
28
33
* Type: `char`. **REQUIRED**
34
+
* Size: 1 byte
29
35
* Example: `R`
30
36
31
-
-`R` | `0x82`: *Request* method used to do calls needs a response
32
37
-`S` | `0x83`: *Signal* method used to send signals like events
38
+
-`R` | `0x82`: *Request* method used to do calls needs a response
39
+
-`r` | `0x114`: *Response* method used to responds a request
33
40
34
41
35
42
ID:
36
43
37
44
Unsigned random number with up to 2^16 that identifies the request.
38
45
39
46
* Type: `uint16_t` as Big Endian format. **REQUIRED**
47
+
* Size: 2 bytes
40
48
* Example: `1822`
41
49
42
50
### PATH
43
51
44
52
The path component contains data, usually organized in hierarchical
45
53
form, that, serves to identify a resource [URI > 3.3 Path](https://www.rfc-editor.org/info/rfc3986).
46
54
47
-
* Type: `uint8_t[]`. **REQUIRED**
48
-
* Example:
49
-
*`0xA` (10)
50
-
*`/foo/bar`
55
+
* Type: `string`. **REQUIRED**
56
+
* Example: `/foo/bar`
51
57
* Default: `/`
52
58
53
59
### HEADERS
@@ -68,7 +74,6 @@ The final data to be used for request receiver. Starts with `B\n`.
68
74
* Message: `B\nlorem ipsum message`
69
75
* Buffer: `['B', '\n', 0x1, 0x2, 0x3, 0x4]`
70
76
71
-
72
77
## Middlewares
73
78
74
79
@TODO Explains what is a middleware and how its works
0 commit comments