Commit 4cb0b28f authored by Jesse Bakker's avatar Jesse Bakker

Add example of request, notification, response sequence

parent 793bbdfb
Pipeline #29260 passed with stages
in 57 seconds
......@@ -27,7 +27,7 @@ The chosen format is [JSON](https://wikipedia.org/wiki/JSON). This format is nic
}
```
- 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.
- 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. This id is repeated in the id field of the response to this request.
- method: string value specifying the type of message
- params: JSON object containing all the params needed to call the specified method
......@@ -41,7 +41,7 @@ The chosen format is [JSON](https://wikipedia.org/wiki/JSON). This format is nic
}
```
A request can either succeed or fail. In case it succeeds, it is possible to return a result, which is specified in the message specification for the respective method. If no result is defined, the result field is not required.
A request can either succeed or fail. In case it succeeds, it is possible to return a result, which is specified in the message specification for the respective method. If no result is defined, the result field must be null.
In case the request fails, the response will contain the error field, of which the format is specified below.
### Error format
......@@ -66,6 +66,40 @@ To distinguish between different kinds of errors, an error code is returned. The
Notification messages are very similar to Request messages, except that they do not contain an id, because they have no response
### Example
In this example, a request is sent, then a notification is received and then the response to the request is received.
Request:
```json
{
"id": 1,
"method": "exampleMethod",
"params": {
"param1": "Param",
"param2": 2
}
}
```
Notification:
```json
{
"method": "exampleNotification",
"params": {}
}
```
Response:
```json
{
"id": 1,
"result": {
"hello": "world"
}
}
```
## Messages
### Handshake
......
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