instantchat/doc/protocol.md

50 lines
987 B
Markdown

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 ???
}