template<typename Connection, bool CLIENT = false, typename Allocator = std::allocator<uint8_t>>
websocket::connection class

Template parameters
Connection - The connection base class. This would usually be the underlying protocol, e.g. an instance of [aes70::connection].
CLIENT - True if this is a client connection.
Allocator

Connection class for WebSocket connections.

Public functions

auto receive(uint8_t* src, uint8_t* src_end) -> bool
auto buffer_size() -> size_t

Protected functions

auto allocate(size_t len) -> uint8_t*

Function documentation

template<typenameConnection, boolCLIENT, typenameAllocator>
bool websocket::connection<Connection, CLIENT, Allocator>::receive(uint8_t* src, uint8_t* src_end)

Receive some incoming data. This will be called from the platform code, e.g. [libuv] or [lwip].

Returns false on error, e.g. if illegal data has been received or on memory allocation failure. In that case, the connection must be closed.

template<typenameConnection, boolCLIENT, typenameAllocator>
size_t websocket::connection<Connection, CLIENT, Allocator>::buffer_size()

Returns the number of bytes currently held in buffers in this connection.

template<typenameConnection, boolCLIENT, typenameAllocator>
uint8_t* websocket::connection<Connection, CLIENT, Allocator>::allocate(size_t len) protected

Returns Returns a pointer to the buffer space for len bytes of payload. Returns nullptr on allocation failure.

Allocate a BINARY frame.