Docu: add initial protocol docu
This commit is contained in:
parent
48c467349d
commit
d5f1e76383
|
|
@ -0,0 +1,49 @@
|
||||||
|
InstantChat WebSocket Protocol
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Messages from client to server (commands)
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
JSON objects. Key `action` determines type of message.
|
||||||
|
|
||||||
|
### init
|
||||||
|
Initialize the connection, set nickname and join/create a chat.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
* `action` = `"init"`
|
||||||
|
* `chat_id`: either an existing ID of a chat instance or *[TODO: ?]* empty string to
|
||||||
|
create a new chat
|
||||||
|
* `nickname`: user's chosen nickname *[TODO: valid characters?]*
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
{
|
||||||
|
"action": "init",
|
||||||
|
"chat_id": "42",
|
||||||
|
"nickname": "Alice"
|
||||||
|
}
|
||||||
|
|
||||||
|
### send (?)
|
||||||
|
Send a message...
|
||||||
|
|
||||||
|
*[TODO]*
|
||||||
|
|
||||||
|
|
||||||
|
Messages from server to client (responses/events)
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
|
JSON objects. Key `type` determines type of message.
|
||||||
|
|
||||||
|
### init
|
||||||
|
Response to `init` command. Confirms initialization and chat join.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
* `type` = `"init"`
|
||||||
|
* ***[TODO]***
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "init",
|
||||||
|
TODO ???
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue