-
Notifications
You must be signed in to change notification settings - Fork 1
Formatting calls
To be able to use the server the client and the server needs to communicate within the same format. When the client sends its response it may only contain the following characters:
- All letters between a and z, both lower- and uppercase
- All numbers
- Slash
/
- Parentheses
( )
- Other allowed characters are:
< > = : ; &
The server separates all commands from each client to make it as easy for the client to handle and interpret the data. Every client's commands are stored within curly brackets {}
. The first data from each client is always the id of the client. Every command is separated with the |
symbol.
Structure of incoming message
{client_id|data|data...}
This is an incoming message from two clients. The first client has id 2 and the second client has id 1. Each of the clients has some data with them, in this case, the client brings its x and y position.
{2|Px4|Py20}{1|Px2|Py20}
Sending data is even easier. Since the server is the application keeping track of all the clients the client can simple just send their commands without assigning any id. To continue on the previous example the client would send a string like this:
Px2|Py20