From f1b6da19a26f1cd6e277d18b4d26f1c56f83ef18 Mon Sep 17 00:00:00 2001 From: hippoz Date: Wed, 8 Sep 2021 00:41:38 +0300 Subject: [PATCH] update documentation to be more accurate to the current implementation --- resources/Docs/DOCS.md | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/resources/Docs/DOCS.md b/resources/Docs/DOCS.md index afd81c7..216bb93 100644 --- a/resources/Docs/DOCS.md +++ b/resources/Docs/DOCS.md @@ -1,6 +1,4 @@ -# Waffle API docs (currently not implemented) - -*Again, this IS NOT YET IMPLEMENTED IN THE CURRENT BRAINLET RELEASE* +# Waffle API docs # Gateway @@ -28,11 +26,11 @@ Packets can also have JSON as a payload: Sent by the server to the client as soon as possible after they connect to the gateway. -This payload can contain a JSON object with various information about the server. It should be relied on only when absolutely necessary. +This payload contains a `pingInterval` property. Every *pingInterval*, the client must send a packet simply containing `7@1`. This is the ACTION_PING payload. If the client does not send this payload at the right time, it is disconnected. Example: ```json -0@{} +0@{"pingInterval":14750} ``` ## 1:YOO @@ -114,28 +112,22 @@ Example: *Auth required, Server to client* -Sent by the server after YOO\_ACK, and otherwise when the entire status needs to be updated. Usually, this will be sent only once, and when subsequent user status updates need to happen, EVENT\_CHANNEL\_MEMBER\_UPDATE should be sent. - -JSON data format (this ones tough): -Contains a JSON object, where each key is a channel id and each property is an array of [user presence objects](#user-presence-object). +An object containing a list of user presences which were updated, where the keys are the user ids and the values are [user presence objects](#user-presence-object). Example: ```json -6@{"totallyrealid":[{_id:"totallyrealuserid",username:"totallyrealusername",status:1,status_text:"hello"}]} +6@{"userid":{_id:"userid",username:"username123",status:1,status_text:"hello"}} ``` -## 7:EVENT\_CHANNEL\_MEMBER\_UPDATE +## 7:ACTION_PING -*Auth required, Server to client* +*Auth required, Client to server* -Sent by the server when the status of a member changes. Of course, the client has to be in a channel with that member in order to receive this update. - -JSON data format: -It's just a [user presence object](#user-presence-object). +Sent by the client every `pingInterval`. The payload of this packet must always be `1`. Example: ```json -7@{_id:"totallyrealuserid",username:"totallyrealusername",status:1,status_text:"hello"} +7@1 ``` ## 21:ACTION_VOICE_REQUEST_SESSION