Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 5783147

Browse files
committed
feat: Add doc for MQTT server
1 parent a517b37 commit 5783147

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

MQTT_server.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Introduction
2+
The structure of this information deisseminating network is based on MQTT protocol which consists of three components. `Connectivity Endpoint`, `tangle-accelerator` and `Parser`
3+
4+
### 1. Connectivity Endpoint
5+
This is a client implemented with any possible lightweight computing node (such as Raspberry Pi) and a communication module (i.e. NB-IoT module). There are some modems allowing users to send MQTT message with AT-command-like command, so for these kinds of modems, they don't need to run a `mosquitto`-dependent programs on the lightweight computing node.
6+
For the `Connectivity Endpoint` which uses a modem provides AT-command-like commands, few things they need to do are choosing the right topic (we use different topics to simulate RESTful methodology) and serializing the data/message into the demanded format which contains `Device ID` for TA requests. After the message is serialized into the demanded format, we can send this message with modem provided command as simple as we send a http request with Python.
7+
8+
### 2. tangle-accelerator
9+
TA (tangle-accelerator) plays a role of server which receives requests from communication module and processes the requests. However, under the structure of this MQTT information deisseminating network, both `tangle-accelerator` and `Connectivity Endpoint` are MQTT client. We must take care that `tangle-accelerator` is not a broker under this topology of MQTT information disseminating network.
10+
`tangle-accelerator` runs as a MQTT subscriber and publisher at the same time which listen to the requests on several different topics and respond the requests according to respective request result. We treat each topic as different URL path of http protocol does.
11+
12+
### 3. Parser
13+
The `Parser` plays a role of both subscriber and publisher simultaneously; thus, we will implement this `Parser`, which is a duplex client by modifying `mosquitto`'s client source code.
14+
Sometimes, it might necessitate parsing MQTT messages, since the messages which are sent from multifarious modems may vary from one to another. In order to support a wide range of modems from different manufactures, we can use a duplex client to revise the messages which are sent from modems into the regulated format, then send the message in regulated format to a specific topic which contains only requests follow TA's request format.
15+
16+
## Communication structure
17+
`<root>` is the host operator defined root path. It can be used if we want to choose a certain host of a cluster.
18+
19+
#### 1. Communication Endpoint sends message
20+
Communication endpoint would send message on topic `<root>/<API>/raw/<parser type ID>`
21+
On this topic, the messages are in raw types whose formats depend on the modems users chose.
22+
And the sub-topic, `<parser type ID>`, aims to pass the message to a appropriate parser (the work that parser should
23+
do is corresponding to multifarious manufacturers or even different modems).
24+
25+
The message should contain the `Device ID` of the `Communication Endpoint`, since the `Device ID` will be used in returning data for `tangle-accelerator`. Once the message is published, Communication Endpoint will start to listen the topic, `<root>/<API>/<Device ID>`. The resonse will be published into this topic
26+
#### 2. Parser parses raw message
27+
Parser parses messages came from topic `<root>/<API>/raw/<parser type ID>` into regulted format of TA.
28+
#### 3. Parser sends neat messages
29+
Parser sends parsed, neat, regulated format messages to topic `<root>/<API>`, and the messages contain `Device ID` of source devices as well.
30+
#### 3. TA receives the message
31+
TA receive the message from topic `<root>/<API>`, and then it starts to process the requests.
32+
The responses will be sent onto topic `<root>/<API>/<Device ID>`.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ both footprint and startup time are behaved pretty well.
4343
4444
```
4545

46+
## Connectivity
47+
48+
`Tangle-accelerator`, at this moment, supports two communication protocols. One is `http`, and the other one is `MQTT`. `http` can be used in the normal internet service.
49+
`MQTT` is a lightweight communication protocol which can be used in the IoT scenarios. `Tangle-accelerator`'s support to `MQTT` allows embedded devices to write data on IOTA internet with relative low quality hardware devices. We hope this accelerates the process blockchain technology steps into our daily lives.
50+
4651
## Documentation
4752

4853
This page contains basic instructions for setting up tangle-accelerator, You can generate full documentation and API reference via Doxygen. The documentation is under `docs/` after generated:

0 commit comments

Comments
 (0)