docs/streaming: add incident op codes and payloads

This commit is contained in:
Luna Mendes 2018-07-18 05:01:32 -03:00
parent 9c2dbeaf59
commit 4407fbd6df
2 changed files with 16 additions and 2 deletions

View File

@ -38,7 +38,9 @@ for each OP below. They are not stored inside of a `d` object, like Discord's ga
|1|`SUBSCRIBED`|Received|
|2|`UNSUBSCRIBED`|Received|
|3|`DATA`|Received|
|4|`INCIDENT_NEW`|Received|
|5|`INCIDENT_UPDATE`|Received|
|6|`INCIDENT_CLOSE`|Received|
## OP Payloads
@ -58,6 +60,13 @@ for each OP below. They are not stored inside of a `d` object, like Discord's ga
- The first element of `d` is an integer, encoding an UNIX timestamp with millisecond precision.
- The second element of `d` is described on *`Channel types`*
- `INCIDENT_NEW`
- data: `d` (`dict`), an incident payload
- `INCIDENT_UPDATE`
- data: `d` (`dict`), an incident payload.
- `INCIDENT_CLOSE`
- data: `d` (`dict`), an incident payload, containing at least the `id` field.
## Channel names
@ -66,6 +75,10 @@ are formatted like: `<type>:<name>`
e.g `status:elixire` and `graph:elixire`
**There is a special channel for incident reporting(OP codes 4, 5 and 6): `incidents`**
***TODO: incident types, stage types, etc.***
### Channel types
- `status` channel
- Returns a boolean, representing the status of the service
@ -78,3 +91,4 @@ e.g `status:elixire` and `graph:elixire`
- Connect a websocket to `/api/streaming`.
- Send a `SUBSCRIBE` payload, receive `SUBSCRIBED` back
- Listen to `DATA` payloads and update local state as needed.
- Optionally: listen to `INCIDENT_{NEW|UPDATE|CLOSE}`

View File

@ -20,7 +20,7 @@ class OP:
# incident specific
INCIDENT_NEW = 4
INC_UPDATE = 5
INCIDENT_CLOSE = 7
INCIDENT_CLOSE = 6
class ErrorCodes: