Merge branch 'feat/client-chat' into chore/ui-checkstyle-fixes
# Conflicts: # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/ChatController.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/ChatModel.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/Message.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/network/ChatClient.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/network/ClientService.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/network/CoreClient.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/network/GameClient.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/network/LobbyClient.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/ChatViewController.java # src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/LobbyButtonGridManager.java # src/main/resources/ui-structure/components/Chatbox.fxml
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
This Document states the Network-Protocol as it is currently implemented
|
||||
|
||||
## GET_MESSAGE_COUNT
|
||||
This Command gets the number of messages, currently stored in the queue for the specific client.
|
||||
(Is used together with GET_NEXT_MESSAGE, to get all messages that are currently in the queue)
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
GET_MESSAGE_COUNT
|
||||
|
||||
1
|
||||
+OK
|
||||
```
|
||||
|
||||
## GET_NEXT_MESSAGE
|
||||
This Command gets the next Message that is being stored in the queue for the client.
|
||||
(Command is being sent the amount of times, the GET_MESSAGE_COUNT Command returns)
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
GET_NEXT_MESSAGE
|
||||
|
||||
TYPE=LOBBY GAME=1 USER=player1 TARGET=null TIME=9:30 TEXT="Guten Tag"
|
||||
+OK
|
||||
```
|
||||
|
||||
## SEND_MESSAGE
|
||||
This Command gets sent if the user of that client writes a message to one of the three possible chats
|
||||
|
||||
(The Arguments / Parameters of the Command describe all the parameters of the Object "Message" being used internally by both the Client and the Server)
|
||||
|
||||
Example:
|
||||
```
|
||||
SEND_MESSAGE TYPE=LOBBY GAME=1 USER=player1 TARGET=null TIME=10:30 TEXT="Hallo Welt"
|
||||
|
||||
+OK
|
||||
```
|
||||
|
||||
## LOG_IN
|
||||
This Command is used to create a user on the server and associate that user with a username
|
||||
Server returns the username, slightly changed if it is already used by someone else, and an ID to identify the client.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
LOG_IN USERNAME="Peter"
|
||||
|
||||
USERNAME="Peter" ID=<random UUID>
|
||||
+OK
|
||||
```
|
||||
|
||||
## LOG_OUT
|
||||
This Command is used to quit the connection between client and server.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
LOG_OUT
|
||||
|
||||
+OK
|
||||
```
|
||||
@@ -341,4 +341,103 @@ LIST_USERS
|
||||
END
|
||||
END
|
||||
END
|
||||
```
|
||||
|
||||
## SEND_MESSAGE command
|
||||
The `SEND_MESSAGE` command is used to transfer the chat message sent by a user to the server.
|
||||
### Required pre-execution checks
|
||||
None.
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------|:----------------|:-------------------------------------------------------------------|
|
||||
| `TYPE` | `Enum<ChatType` | GLOBAL, LOBBY or WHISPER, specifying the Chat |
|
||||
| `GAME` | `int` | ID for identifying the Lobby Chat |
|
||||
| `USER` | `String` | Username of the player that sent the message |
|
||||
| `TARGET` | `String` | Username of to which the message is sent to (only in Whisper Chat) |
|
||||
| `TIME` | `String` | Timestamp, when the message was sent |
|
||||
| `TEXT` | `String` | Content of the message |
|
||||
|
||||
### Success Response
|
||||
No response fields.
|
||||
|
||||
### Error Response
|
||||
None.
|
||||
|
||||
### Example Request
|
||||
```
|
||||
SEND_MESSAGE TYPE=GLOBAL GAME=1 USER=player1 TARGET=null TIME='10:30' TEXT='Hello World'
|
||||
```
|
||||
|
||||
### Example Response
|
||||
```
|
||||
+OK
|
||||
END
|
||||
```
|
||||
|
||||
## GET_MESSAGE_COUNT command
|
||||
The `GET_MESSAGE_COUNT` is used to get the current number of messages that are stored in the queue for a client.
|
||||
### Required pre-execution checks
|
||||
None.
|
||||
|
||||
### Request Parameters
|
||||
No parameters.
|
||||
|
||||
### Success Response
|
||||
|
||||
| Field | Type | Description |
|
||||
|:--------|:------|:-------------------------------|
|
||||
| `COUNT` | `int` | The current number of messages |
|
||||
|
||||
### Error Response
|
||||
| Code | Description |
|
||||
| :------------------- |:---------------------------------------------------------------------------------|
|
||||
| `NO_USER_ASSOCIATED` | The session has no user associated, there is no queue of messages for the client |
|
||||
|
||||
|
||||
### Example Request
|
||||
```
|
||||
GET_MESSAGE_COUNT
|
||||
```
|
||||
|
||||
### Example Response
|
||||
```
|
||||
+OK
|
||||
COUNT=10
|
||||
END
|
||||
```
|
||||
|
||||
## GET_NEXT_MESSAGE command
|
||||
The `GET_NEXT_MESSAGE` command is used to get the next message stored in a queue for the client.
|
||||
### Required pre-execution checks
|
||||
None.
|
||||
|
||||
### Request Parameters
|
||||
No parameters.
|
||||
|
||||
### Success Response
|
||||
| Field | Type | Description |
|
||||
|:---------|:----------------|:-------------------------------------------------------------------|
|
||||
| `TYPE` | `Enum<ChatType` | GLOBAL, LOBBY or WHISPER, specifying the Chat |
|
||||
| `GAME` | `int` | ID for identifying the Lobby Chat |
|
||||
| `USER` | `String` | Username of the player that sent the message |
|
||||
| `TARGET` | `String` | Username of to which the message is sent to (only in Whisper Chat) |
|
||||
| `TIME` | `String` | Timestamp, when the message was sent |
|
||||
| `TEXT` | `String` | Content of the message |
|
||||
### Error Response
|
||||
| Code | Description |
|
||||
| :------------------- |:---------------------------------------------------------------------------------|
|
||||
| `NO_USER_ASSOCIATED` | The session has no user associated, there is no queue of messages for the client |
|
||||
|
||||
### Example Request
|
||||
```
|
||||
GET_NEXT_MESSAGE
|
||||
```
|
||||
|
||||
### Example Response
|
||||
```
|
||||
+OK
|
||||
TYPE=GLOBAL GAME=-1 USER=player1 TARGET=null TIME=9:30 TEXT="Guten Tag"
|
||||
END
|
||||
```
|
||||
Reference in New Issue
Block a user