Write protocol document outline and document existing commands #245
@@ -21,20 +21,28 @@ This document describes the protocol for client-server communication in our appl
|
|||||||
- [Required pre-execution checks](#required-pre-execution-checks)
|
- [Required pre-execution checks](#required-pre-execution-checks)
|
||||||
- [Request Parameters](#request-parameters)
|
- [Request Parameters](#request-parameters)
|
||||||
- [Success Response](#success-response)
|
- [Success Response](#success-response)
|
||||||
|
- [Example Request](#example-request)
|
||||||
|
- [Example Response](#example-response)
|
||||||
- [CHECK\_USERNAME command](#check_username-command)
|
- [CHECK\_USERNAME command](#check_username-command)
|
||||||
- [Required pre-execution checks](#required-pre-execution-checks-1)
|
- [Required pre-execution checks](#required-pre-execution-checks-1)
|
||||||
- [Request Parameters](#request-parameters-1)
|
- [Request Parameters](#request-parameters-1)
|
||||||
- [Success Response](#success-response-1)
|
- [Success Response](#success-response-1)
|
||||||
|
- [Example Request](#example-request-1)
|
||||||
|
- [Example Response](#example-response-1)
|
||||||
- [LOGIN comamnd](#login-comamnd)
|
- [LOGIN comamnd](#login-comamnd)
|
||||||
- [Required pre-execution checks](#required-pre-execution-checks-2)
|
- [Required pre-execution checks](#required-pre-execution-checks-2)
|
||||||
- [Request Parameters](#request-parameters-2)
|
- [Request Parameters](#request-parameters-2)
|
||||||
- [Success Response](#success-response-2)
|
- [Success Response](#success-response-2)
|
||||||
- [Error Response](#error-response-4)
|
- [Error Response](#error-response-4)
|
||||||
|
- [Example Request](#example-request-2)
|
||||||
|
- [Example Response](#example-response-2)
|
||||||
- [LOGOUT command](#logout-command)
|
- [LOGOUT command](#logout-command)
|
||||||
- [Required pre-execution checks](#required-pre-execution-checks-3)
|
- [Required pre-execution checks](#required-pre-execution-checks-3)
|
||||||
- [Request Parameters](#request-parameters-3)
|
- [Request Parameters](#request-parameters-3)
|
||||||
- [Success Response](#success-response-3)
|
- [Success Response](#success-response-3)
|
||||||
- [Error Response](#error-response-5)
|
- [Error Response](#error-response-5)
|
||||||
|
- [Example Request](#example-request-3)
|
||||||
|
- [Example Response](#example-response-3)
|
||||||
|
|
||||||
<!-- Plase see the comments for copy n' paste ready examples -->
|
<!-- Plase see the comments for copy n' paste ready examples -->
|
||||||
|
|
||||||
@@ -140,6 +148,23 @@ Description of the command, what it does and when it should be used.
|
|||||||
| Code | Discription |
|
| Code | Discription |
|
||||||
| :----------- | :----------------------- |
|
| :----------- | :----------------------- |
|
||||||
| `ERROR_CODE` | Description of the error |
|
| `ERROR_CODE` | Description of the error |
|
||||||
|
|
||||||
|
### Example Request
|
||||||
|
```
|
||||||
|
COMMAND_NAME PARAM1='value1' PARAM2='value2'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Response
|
||||||
|
```
|
||||||
|
+OK
|
||||||
|
KEY1=VALUE1
|
||||||
|
FIELDS
|
||||||
|
FIELD
|
||||||
|
NESTED_KEY=NESTED_VALUE
|
||||||
|
END
|
||||||
|
KEY2=VALUE2
|
||||||
|
END
|
||||||
|
```
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## PING command
|
## PING command
|
||||||
@@ -154,6 +179,17 @@ No parameters.
|
|||||||
### Success Response
|
### Success Response
|
||||||
No response fields.
|
No response fields.
|
||||||
|
|
||||||
|
### Example Request
|
||||||
|
```
|
||||||
|
PING
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Response
|
||||||
|
```
|
||||||
|
+OK
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## CHECK_USERNAME command
|
## CHECK_USERNAME command
|
||||||
The `CHECK_USERNAME` command is used to check if a username is already taken by another user. Additional users can still login with the same username, but thier name will be subsituted with a suffix.
|
The `CHECK_USERNAME` command is used to check if a username is already taken by another user. Additional users can still login with the same username, but thier name will be subsituted with a suffix.
|
||||||
@@ -176,6 +212,17 @@ None.
|
|||||||
| `FREE` | Username is available |
|
| `FREE` | Username is available |
|
||||||
| `TAKEN` | Username is already in use |
|
| `TAKEN` | Username is already in use |
|
||||||
|
|
||||||
|
### Example Request
|
||||||
|
```
|
||||||
|
CHECK_USERNAME USERNAME='Lars'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Response
|
||||||
|
```
|
||||||
|
+OK
|
||||||
|
STATUS=FREE
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
## LOGIN comamnd
|
## LOGIN comamnd
|
||||||
The `LOGIN` command is used to log in a user with a specified username. If the username is already taken by another user, the server will append a suffix to the username to make it unique.
|
The `LOGIN` command is used to log in a user with a specified username. If the username is already taken by another user, the server will append a suffix to the username to make it unique.
|
||||||
@@ -199,6 +246,19 @@ None.
|
|||||||
| :------------------ | :----------------------------------------------------------------------------- |
|
| :------------------ | :----------------------------------------------------------------------------- |
|
||||||
| `ALREADY_LOGGED_IN` | The session is already associated with a user, logging in again is prohibited. |
|
| `ALREADY_LOGGED_IN` | The session is already associated with a user, logging in again is prohibited. |
|
||||||
|
|
||||||
|
### Example Request
|
||||||
|
```
|
||||||
|
LOGIN USERNAME='Lars'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Response
|
||||||
|
```
|
||||||
|
+OK
|
||||||
|
USERNAME='Lars_1234'
|
||||||
|
ID=e47a671e-2b2a-42df-bb82-953fe2ebd307
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## LOGOUT command
|
## LOGOUT command
|
||||||
Description of the command, what it does and when it should be used.
|
Description of the command, what it does and when it should be used.
|
||||||
@@ -216,3 +276,14 @@ No response fields.
|
|||||||
| Code | Discription |
|
| Code | Discription |
|
||||||
| :----------------- | :--------------------------------------------------------------- |
|
| :----------------- | :--------------------------------------------------------------- |
|
||||||
| `NO_USER_ASSOCIATED` | The session has no user associated, logging out is not possible. |
|
| `NO_USER_ASSOCIATED` | The session has no user associated, logging out is not possible. |
|
||||||
|
|
||||||
|
### Example Request
|
||||||
|
```
|
||||||
|
LOGOUT
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Response
|
||||||
|
```
|
||||||
|
+OK
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user