Update page 'Protocol'
21
Protocol.md
21
Protocol.md
@@ -7,9 +7,9 @@ At the moment, it doesn't use **TLS** but plan to in a near future.
|
||||
|
||||
A simple packet looks like this:
|
||||
|
||||
| Command | Argument 1 | Argument 2 |
|
||||
| :-----: | :--------: | :--------: |
|
||||
| PING | Hello | World! |
|
||||
| Command | Argument 1 |
|
||||
| :-----: | :----------: |
|
||||
| PING | Hello World! |
|
||||
|
||||
- **Command** - Always represent a single **uppercase** word as a command
|
||||
- **Arguments** - Represent a **semicolon-delimited** list of arguments
|
||||
@@ -18,19 +18,19 @@ Since all is a string, it is represented as:
|
||||
|
||||
```md
|
||||
PING
|
||||
Hello;World!\n
|
||||
Hello World!\n
|
||||
```
|
||||
|
||||
Notice the `\n` at the end, it is used to show the end of the packet.
|
||||
So, in one line, the packet is: `PING\nHello;World!\n`
|
||||
So, in one line, the packet is: `PING\nHello World!\n`
|
||||
|
||||
## ID
|
||||
|
||||
Since the broker need to know the destination of a packet, we add an id as an argument:
|
||||
|
||||
| Command | Argument 1 | Argument 2 | Argument 3 |
|
||||
| :-----: | :--------: | :--------: | :--------: |
|
||||
| PING | ID | Hello | World! |
|
||||
| Command | Argument 1 | Argument 2 |
|
||||
| :-----: | :--------: | :----------: |
|
||||
| PING | ID | Hello World! |
|
||||
|
||||
- **ID** - a 64 bit unsigned integer
|
||||
|
||||
@@ -38,7 +38,7 @@ Here is the string representation:
|
||||
|
||||
```md
|
||||
PING
|
||||
ID;Hello;World!\n
|
||||
ID;Hello World!\n
|
||||
```
|
||||
|
||||
The consequence is that the first argument is **always** used for the **ID**
|
||||
@@ -120,6 +120,7 @@ Here, a client send a 'ping' request to a server and the server reply with a 'po
|
||||
|
||||
Each command is described in a dedicated page
|
||||
|
||||
> Note: ID is always omitted in a command description but present in reality, same for the end `\n`
|
||||
> Note: ID is always omitted in command descriptions for readability but
|
||||
> present in reality, same for the end `\n`
|
||||
|
||||
- [PING](https://eveldee.ddns.net:1342/Eveldee/PlantBox/wiki/Command_Ping)
|
||||
Reference in New Issue
Block a user