vybe/DOCS.md

96 lines
1.2 KiB
Markdown

# vybe websocket protocol - sent by client
socket.io actions + expected msg format and other info
all responses have same type as original message
if a message fails, you get a response with the following format:
```json
{
"success": false,
"message": "Something broke"
}
```
## authenticate
you must generate a random salt, sign a message `vybe_auth [salt]`, and then send
```json
{
"name": "username",
"message": "that message you signed"
}
```
## create_user
Message format:
```json
{
"name": "unique_username",
"pubkey": "your PGP public key"
}
```
Response format:
```json
{
"success": true,
"id": 123
}
```
## get_history
```json
{
"before": 100 // message ID. if ommitted just starts from end
}
```
Response format:
```json
{
"success": true,
"messages": [], // each message has same format as new_message
"more": true // false if there are no more
}
```
## send_message
Message format:
```json
{
"name": "unique_username",
"message": "message"
}
```
Response format:
```json
{
"success": true,
"id": 111
}
```
# sent by server
## new_message
```json
{
"id": 69,
"name": "unique_username",
"message": "msg text"
}
```