From ad6106250bf7abe158064aa5a1794a7578a2f6c7 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sat, 30 Aug 2025 22:19:36 +0200 Subject: [PATCH] Improved protcol --- README.md | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 36df25e..ae32f70 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,30 @@ Self host your voxa community server with customizable plugins # Protocol -The protocol involves mixing simple principles with complex principles. - -1. If the client is online then the client will connect to all the servers, not just the "current server". -2. If a server sends a `Message` the client processes it as a notification. -3. A `Message` should only be sent to the client if the server knows that the user that the client is wrapping has been on this server before the messages were present, otherwise it will send a `InitialMessage`. +1. When the client is running in the background or windowed, it's connected to the [Voxa Cloud server](#voxa-cloud) ## Handshake -Client -> Connect -> Server +Client -> Cloud: `{ GenerateServerAuth: {} }` -Server -> Public RSA -> Client +Cloud -> Cloud: `{ ServerAuth: { auth: } }` -Client -> RSA encrypted AES key -> Server +Client -> Server: Connect -Client -> (AES) `{ session_id: }` -> Server +Client -> Server: `{ auth: }` -Server -> Validate Session-Id via HTTP -> Voxa cloud +Server -> Cloud: `GET /validate-auth?auth=` -Server -> (AES) `{ id: 0, result: "ok", session_id: }` -> Client +Cloud -> Server: `{ 200 OK { username: , name: , id: } }` ## Sending a message -Client -> (AES) `{ id: 10, SendMessage: { content: "This is a test", channel: } }` -> Server +Client -> Server: `{ SendMessage: { content: } }` -Server -> (AES) `{ id: 10, result: "ok" }` -> Client +Server -> Cloud: `POST /message { content: , author: }` -## Receiving a message +Cloud -> Client(s): `{ Message: { content: , author: } }` -Server -> (AES) `{ id: 23, Message: { content: "This is a test", author: , channel: } }` -> Client +# Voxa Cloud -Client -> (AES) `{ id: 23, result: "ok" }` -> Server - -## Sending and receiving voice chat - -Client -> (AES) `{ ConnectVoice: { channel: } }` -> Server - -Client -> (AES) `{ VoiceData: [ ] }` -> Server - -Server -> (AES) `{ : [ ] }` -> Client - -Client -> (AES) `{ DisconnectVoice: [] }` -> Server - -## Edge cases - -- **Client closes TCP prematurely on voice chat**: Server should handle the voice disconnecting on it's own. -- **Server disconnects Client from voice chat**: In the case that a Server needs to disconnect a Client, the server will send the `DisconnectVoice` method to the Client to notify that any further `VoiceData` won't be processed. -- **Invalid or outdated protocol**: Both Server and Client should check for a update and update if `auto_update` is enabled, it's important to keep the server always updated. -- **`Message` cannot be sent at the moment**: The server will sent after the next [Handshake](#handshake) \ No newline at end of file +The voxa cloud server is the main auth and notification handler.