Docu: add initial protocol docu
This commit is contained in:
parent
48c467349d
commit
d5f1e76383
1 changed files with 49 additions and 0 deletions
49
doc/protocol.md
Normal file
49
doc/protocol.md
Normal file
|
|
@ -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…
Add table
Add a link
Reference in a new issue