|
@@ -1,40 +1,37 @@
|
|
# Client-Server Protocol
|
|
# Client-Server Protocol
|
|
|
|
|
|
|
|
+Protocol version: "0.1"
|
|
|
|
+
|
|
## 1. Start a connection
|
|
## 1. Start a connection
|
|
|
|
|
|
-To start a connection you have to check the versions, generate the sessonID and verify the login.
|
|
|
|
-Only if step 1.1 is accomplished and the sessionID of the client was valid or if step 1.1 and 1.2 have been accomplished a usable connection is negotiated.
|
|
|
|
|
|
+To start a connection you have to check the versions and verify the login.
|
|
|
|
+Only if step 1.1 and 1.2 have been accomplished a usable connection is negotiated.
|
|
|
|
|
|
### 1.1 Version check
|
|
### 1.1 Version check
|
|
Client:
|
|
Client:
|
|
```
|
|
```
|
|
{
|
|
{
|
|
- "version": string,
|
|
|
|
- "sid": string
|
|
|
|
|
|
+ "version": string
|
|
}
|
|
}
|
|
```
|
|
```
|
|
-Only sends `sid` if client has an old sessionID.
|
|
|
|
|
|
|
|
|
|
|
|
Server:
|
|
Server:
|
|
```
|
|
```
|
|
{
|
|
{
|
|
"version": string,
|
|
"version": string,
|
|
- "accept": bool,
|
|
|
|
- "sid": string
|
|
|
|
|
|
+ "accept": bool
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
-If `accept` is `true` the connection is valid. Else the connection will be terminated.
|
|
|
|
-`sid` can be set if accept is `true` and must be set if the `sid` of the client is invalid. So the server gives a new `sid` if the session is invalid. The server can as well use no `sid`. If the server forbids `sid`s but the client is offering one then the connection is to be immediately closed!
|
|
|
|
|
|
+If `accept` is `true` the connection is valid. Else the connection will be terminated after the server answered.
|
|
|
|
|
|
### 1.2 Login
|
|
### 1.2 Login
|
|
Client:
|
|
Client:
|
|
```
|
|
```
|
|
{
|
|
{
|
|
"user": string,
|
|
"user": string,
|
|
- "pass": string,
|
|
|
|
- "sid": string
|
|
|
|
|
|
+ "pass": string
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
@@ -45,8 +42,7 @@ Server:
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
-If `accept` is `true` the connection is valid and the user is logged in. Else the connection will be terminated.
|
|
|
|
-The server is not obligated to send `sid` back.
|
|
|
|
|
|
+If `accept` is `true` the connection is valid and the user is logged in. Else the connection will be terminated after the server answered.
|
|
|
|
|
|
|
|
|
|
## 2. Sending commands
|
|
## 2. Sending commands
|
|
@@ -80,11 +76,9 @@ Server:
|
|
Client:
|
|
Client:
|
|
```
|
|
```
|
|
{
|
|
{
|
|
- "command": "close",
|
|
|
|
- "remembersID": bool
|
|
|
|
|
|
+ "command": "close"
|
|
}
|
|
}
|
|
```
|
|
```
|
|
-`remembersID` is optional. If it's `true` then the sID shall be remembered by the server. Else it shall be forgotten.
|
|
|
|
|
|
|
|
|
|
|
|
Server:
|
|
Server:
|