Commit 6e70ad02 authored by Jesse Bakker's avatar Jesse Bakker

Add format and TOC

parent f22115a4
# Protocol specification
Protocol specification for the programming project of the Software Science module 2019-2020
Protocol specification for the programming project of the Software Science module 2019-2020.
We specify the program flow, format and different kinds of messages, all with linked examples. If you have any questions, please ask in the slack and we will try to answer them as best we can and, if necessary, add clarifications on this page.
## Contents
1. [Program flow](#program-flow)
2. [Format](#format)
3. [Messages](#messages)
## Program flow
## Format
The chosen format is [JSON](https://wikipedia.org/wiki/JSON). This format is nice because it is structured and easy to parse, while remaining easily readable by humans. We define two types of messages: *Request* and *Notification*, the difference being that a *Request* expects a *Response*, while a *Notification* does not.
### Request format
```json
{
"id": <request id>,
"method": "<method name>",
"params": <param object>
}
```
- id: integer value that is used to couple responses to requests. Using this enables asynchronous messaging, like sending a chat message (extension) while the server has not responded to sending a move yet.
- method: string value specifying the type of message
- params: JSON object containing all the params needed to call the specified method
### Response format
```json
{
"id": <request id>,
"method": "<method name>",
"params": <param object>
}
```
### Notification format
```json
{
"method": "<method name>",
"params": <param object>
}
```
Notification messages are very similar to Request messages, except that they do not contain an id, because they have no response
## Messages
### Handshake
......@@ -73,7 +120,7 @@ class JoinRoomParams {
_Errors_:
- Room is full: `ERROR_ROOM_full`
- Room is full: `ERROR_ROOM_FULL`
- Team is full: `ERROR_TEAM_FULL`
### Game
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment