Ver Fonte

Logout + use types

anon há 4 anos atrás
pai
commit
0703b31d94
1 ficheiros alterados com 32 adições e 9 exclusões
  1. 32 9
      Client-Server Protocol.md

+ 32 - 9
Client-Server Protocol.md

@@ -9,8 +9,8 @@ Only if step 1.1 is accomplished is and the sessionID of the client was valid or
 Client:
 ```
 {
-	"version": "versionstring",
-	"sid": "sessionID"
+	"version": string,
+	"sid": string
 }
 ```
 Only sends `sid` if client has an old sessionID.
@@ -19,22 +19,22 @@ Only sends `sid` if client has an old sessionID.
 Server:
 ```
 {
-	"version": "versionstring",
+	"version": string,
 	"accept": bool,
-	"sid": "sessionID"
+	"sid": string
 }
 ```
 
 If `accept` is `true` the connection is valid. Else the connection will be terminated.
-`sid` must be set if accept is `true` and if the `sid` of the client is invalid. So the server gives a new `sid` if the session is invalid.
+`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!
 
 ### 1.2 Login
 Client:
 ```
 {
-	"user": "username",
-	"pass": "password",
-	"sid": "sessionID"
+	"user": string,
+	"pass": string,
+	"sid": string
 }
 ```
 
@@ -66,8 +66,31 @@ Server:
 ```
 {
 	"command": "status",
-	"response": "command response"
+	"response": string
 }
 ```
 
 ### TODO
+
+
+## 3. Close connection
+
+### 3.1 Close command
+
+Client:
+```
+{
+	"command": "close",
+	"remembersID": bool
+}
+```
+`remembersID` is optional. If it's `true` then the sID shall be remembered by the server. Else it shall be forgotten.
+
+
+Server:
+```
+{
+	"command": "close",
+	"response": "bye"
+}
+```