Browse Source

list, put and get command specification

anon 5 years ago
parent
commit
e87071ced1
1 changed files with 89 additions and 0 deletions
  1. 89 0
      Client-Server Protocol.md

+ 89 - 0
Client-Server Protocol.md

@@ -66,6 +66,95 @@ Server:
 }
 ```
 
+### 2.2 List command
+Client:
+```
+{
+	"command": "list"
+}
+```
+
+Server:
+```
+{
+	"command": "put",
+	"response": string,
+	"remaining": int
+}
+```
+The server loops this until all names have been sent and `remaining` hits `0`.
+
+
+### 2.3 Put command
+Client:
+```
+{
+	"command": "put",
+	"file": string,
+	"size": int
+}
+```
+
+Server:
+```
+{
+	"command": "put",
+	"accept": bool
+}
+```
+If `accept` is `true` the connection is valid and the client can start sending the file. Else the put request was rejected and is hereby canceled.
+<br>
+Client:
+```
+{
+	"command": "put",
+	"data": string,
+	"finish": bool
+}
+```
+`data` is a base64 string and contains a piece of the file. The client will loop this until the file is completely sent.
+In the last request the client has to set the `finish` flag to `true`.
+<br>
+After the last part was received the server answers with `finish` set to `true`.
+<br>
+Server:
+```
+{
+	"command": "put",
+	"finish": bool
+}
+```
+
+### 2.4 Get command
+Client:
+```
+{
+	"command": "get",
+	"file": string
+}
+```
+
+Server:
+```
+{
+	"command": "get",
+	"accept": bool
+}
+```
+If `accept` is `true` the connection is valid and the server can start sending the file. Else the get request was rejected and is hereby canceled.
+<br>
+Server:
+```
+{
+	"command": "get",
+	"data": string,
+	"finish": bool
+}
+```
+`data` is a base64 string and contains a piece of the file. The server will loop this until the file is completely sent.
+In the last request the server has to set the `finish` flag to `true`.
+
+
 ### TODO