WebSocket::receiveFrame(void* buffer, int length, int& flags) writes the received frame into a buffer statically assigned by the caller, and throws if it sees a websocket frame larger than that buffer. There's no general "good size" for that buffer as messages will often be small, but if there's any chance of an application using a large frame occasionally you'll need to allocate a very large buffer that'll seldom be used.

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: