|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
Protocol version: <b>"0.3"</b>
|
|
|
|
|
|
-Every json message must be minimized and be followed by a newline. This rule makes receiving and parsing the messages easier because you can read until a newline comes and you will parse every json message seperately because you won't read multiple json messages from the buffer at a time.
|
|
|
+Every json message must be minimized (i.e. must not contain newlines) and be followed by a newline. This rule makes receiving and parsing the messages easier because you can read until a newline comes and you will parse every json message seperately because you won't read multiple json messages from the buffer at a time.
|
|
|
|
|
|
## 0. Connect to the server
|
|
|
|
|
@@ -64,7 +64,7 @@ CLI:
|
|
|
}
|
|
|
```
|
|
|
|
|
|
-If `accept` is `true` the connection is valid and the user is logged in. Else `error` has an error string and the connection will be terminated after the server answered.
|
|
|
+If `accept` is `true` the connection is valid and the user is logged in. Else `error` has an error string and the connection to the server will be terminated after the server answered.
|
|
|
|
|
|
### 1.2.2 Signup
|
|
|
GUI:
|
|
@@ -72,7 +72,7 @@ GUI:
|
|
|
write: "signup" username new_password
|
|
|
```
|
|
|
|
|
|
-Server:
|
|
|
+CLI:
|
|
|
```
|
|
|
{
|
|
|
"command": "signup",
|
|
@@ -81,7 +81,7 @@ Server:
|
|
|
}
|
|
|
```
|
|
|
|
|
|
-If `accept` is `true` the connection is valid and the user is logged in and signed up. Else `error` has an error string and the connection will be terminated after the server answered.
|
|
|
+If `accept` is `true` the connection is valid and the user is logged in and signed up. Else `error` has an error string and the connection to the server will be terminated after the server answered.
|
|
|
|
|
|
|
|
|
## 2. Sending commands
|
|
@@ -298,7 +298,7 @@ Client:
|
|
|
write: "queue" file_name
|
|
|
```
|
|
|
|
|
|
-Server:
|
|
|
+CLI:
|
|
|
```
|
|
|
{
|
|
|
"command": "queue",
|
|
@@ -317,7 +317,7 @@ Client:
|
|
|
write: "dequeue" file_name
|
|
|
```
|
|
|
|
|
|
-Server:
|
|
|
+CLI:
|
|
|
```
|
|
|
{
|
|
|
"command": "dequeue",
|
|
@@ -388,3 +388,20 @@ CLI:
|
|
|
```
|
|
|
|
|
|
If `accept` is true, the connection is closed and the program can exit.
|
|
|
+
|
|
|
+## 4. Errors
|
|
|
+
|
|
|
+If an unexpected error occurs, the GUI might receive an `error` message:
|
|
|
+```
|
|
|
+{
|
|
|
+ "command": "error",
|
|
|
+ "error": string
|
|
|
+}
|
|
|
+```
|
|
|
+If the server does not respond to requests for some time, the GUI receives a `connectionerror` message and the the connection to the server is terminated:
|
|
|
+```
|
|
|
+{
|
|
|
+ "command": "connectionerror",
|
|
|
+ "error": string
|
|
|
+}
|
|
|
+```
|