Websocket Frame.
More...
#include <WebsocketFrame.h>
|
uint8_t | encodeFrame (WSFrameType frameType, uint8_t *payload, size_t length, uint8_t mask, uint8_t fin, uint8_t headerToPayload=true) |
|
uint8_t | decodeFrame (uint8_t *buffer, size_t length) |
| Encode given buffer to valid websocket frame. More...
|
|
|
uint8_t | _getFrameSizes (uint8_t *buffer, size_t length) |
|
|
uint8_t * | _payload = nullptr |
| Decode given buffer containing websocket frame to payload. More...
|
|
size_t | _payloadLength = 0 |
|
uint8_t * | _header = nullptr |
|
size_t | _headerLength = 0 |
|
WSFrameType | _frameType = WSFrameType::empty |
|
uint8_t | _mask = 0 |
|
|
class | HttpServer |
|
class | Websocket |
|
class | WebsocketClient |
|
uint8_t WebsocketFrameClass::decodeFrame |
( |
uint8_t * |
buffer, |
|
|
size_t |
length |
|
) |
| |
Encode given buffer to valid websocket frame.
- Parameters
-
frameType | Websocket frame type text or binary |
payload | Pointer to buffer to be encoded as websocket frame |
length | Length of buffer to be encoded as websocket frame |
mask | If true websocket frame will be masked (required for client->server communication) |
fin | If true produce ordinary websocket frame, not continuation. Currently MUST be true. |
headerToPayload | If true try to create single buffer message with header and payload, otherwise produce separate header and payload buffers |
- Return values
-
Return | true on success, false on error |
if successfully executed, check whether _header is not nullptr and either use _header and _payload or just _payload as websocket frame
uint8_t* WebsocketFrameClass::_payload = nullptr |
|
protected |
Decode given buffer containing websocket frame to payload.
- Parameters
-
buffer | Pointer to buffer to be decoded as websocket frame |
length | Length of buffer to be decoded as websocket frame |
- Return values
-
Return | true on success, false on error |
if successfully executed, check _frameType to decide what to do with payload pointed by _payload