add litecord voice server protocol (lvsp) draft

This commit is contained in:
Luna 2019-03-01 03:12:50 -03:00
parent 1bc04449bd
commit 7270462325
2 changed files with 94 additions and 0 deletions

3
docs/README.md Normal file
View File

@ -0,0 +1,3 @@
# Internal documentation
The Litecord Voice Server Protocol (LVSP) is documented here.

View File

@ -0,0 +1,91 @@
# Litecord Voice Server Protocol (LVSP)
LVSP is a protocol for Litecord to communicate with an external component
dedicated for voice data. The voice server is responsible for the
Voice Websocket Discord and Voice UDP connections.
LVSP runs over a websocket with TLS. The encoding is JSON.
## High level
In a high level:
- Litecord connects to the Voice Server via a URL already configured
beforehand.
-
## OP code table
"client" is litecord. "server" is the voice server.
**TODO:** voice state management.
| opcode | name | sent by |
| --: | :-- | :-- |
| 0 | HELLO | server |
| 1 | IDENTIFY | client |
| 2 | RESUME | client |
| 3 | READY | server |
| 4 | HEARTBEAT | client |
| 5 | HEARTBEAT\_ACK | server |
## high level overview
- connect, receive HELLO
- send IDENTIFY or RESUME
- receive READY
- start HEARTBEAT'ing
## HELLO message
Sent by the server when a connection is established.
| field | type | description |
| --: | :-- | :-- |
| heartbeat\_interval | integer | amount of milliseconds to heartbeat with |
## IDENTIFY message
Sent by the client to identify itself.
| field | type | description |
| --: | :-- | :-- |
| token | string | secret value kept between client and server |
## RESUME message
Sent by the client to resume itself from a failed websocket connection.
The server will resend its data, then send a READY message.
| field | type | description |
| --: | :-- | :-- |
| token | string | same value from IDENTIFY.token |
| seq | integer | last sequence number to resume from |
## READY message
**TODO**
| field | type | description |
| --: | :-- | :-- |
## HEARTBEAT message
Sent by the client as a keepalive / health monitoring method.
The server MUST reply with a HEARTBEAT\_ACK message back in a reasonable
time period.
**TODO**
| field | type | description |
| --: | :-- | :-- |
## HEARTBEAT\_ACK message
Sent by the server in reply to a HEARTBEAT message coming from the client.
**TODO**
| field | type | description |
| --: | :-- | :-- |