The size of a websocket frame is encoded in the first few bytes of the packet, so it would be a fairly minor change to support returning a dynamically assigned buffer instead, either by allowing receiveFrame() to realloc a buffer passed to it, or by allocating something like std::string inside receiveFrame(), something like this:
- Code: Select all
std::string WebSocket::receiveFrame(int& flags)
int WebSocket::sendFrame(std::string buffer, int flags)
Transparent reassembly of fragmented packets might be useful too.