|
@@ -0,0 +1,71 @@
|
|
|
+# Client-Server Protocol
|
|
|
+
|
|
|
+## 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 and 1.2 have been accomplished a usable connection is negotiated.
|
|
|
+
|
|
|
+### 1.1 Version check
|
|
|
+Client:
|
|
|
+```
|
|
|
+{
|
|
|
+ "version": "versionstring"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+Server:
|
|
|
+```
|
|
|
+{
|
|
|
+ "version": "versionstring",
|
|
|
+ "accept": bool,
|
|
|
+ "sid": "sessionID"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+If `accept` is `true` the connection is valid. Else the connection will be terminated.
|
|
|
+`sid` must be set if accept is `true`.
|
|
|
+
|
|
|
+### 1.2 Login
|
|
|
+Client:
|
|
|
+```
|
|
|
+{
|
|
|
+ "user": "username",
|
|
|
+ "pass": "password",
|
|
|
+ "sid": "sessionID"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+Server:
|
|
|
+```
|
|
|
+{
|
|
|
+ "accept": bool
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+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.
|
|
|
+
|
|
|
+
|
|
|
+## 2. Sending commands
|
|
|
+
|
|
|
+Commands can be sent by the client after a connection has been negotiated (See 1).
|
|
|
+Commands can be used unrelated to each other.
|
|
|
+
|
|
|
+### 2.1 Status command
|
|
|
+Client:
|
|
|
+```
|
|
|
+{
|
|
|
+ "command": "status",
|
|
|
+ "sid": "sessionID"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+Server:
|
|
|
+```
|
|
|
+{
|
|
|
+ "command": "status",
|
|
|
+ "response": "command response"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+### TODO
|