Add binary protocol v2 & v3 to websocket

This commit is contained in:
Terrence
2025-04-28 16:29:33 +08:00
parent 1f03d770cc
commit 5f8389c135
5 changed files with 86 additions and 13 deletions

View File

@@ -5,6 +5,21 @@
#include <string>
#include <functional>
#include <chrono>
#include <vector>
struct AudioStreamPacket {
uint32_t timestamp;
std::vector<uint8_t> payload;
};
struct BinaryProtocol2 {
uint16_t version;
uint16_t type; // Message type (0: OPUS, 1: JSON)
uint32_t reserved; // Reserved for future use
uint32_t timestamp; // Timestamp in milliseconds (used for server-side AEC)
uint32_t payload_size; // Payload size in bytes
uint8_t payload[]; // Payload data
} __attribute__((packed));
struct BinaryProtocol3 {
uint8_t type;