uce/site/doc/pages/ws_message.txt
2026-06-16 23:02:45 +00:00

20 lines
569 B
Plaintext

:sig
String ws_message()
:params
return value : payload of the current WebSocket message
:see
>websocket
:content
Returns the payload of the current WebSocket message being handled by `WS(Request& context)`.
For text frames this is the decoded text payload. For binary frames this `String` contains the raw message bytes.
Use `ws_is_binary()` or `ws_opcode()` to choose how to parse the payload.
:example
// Inside a WS message handler ws_message() returns the current frame payload.
print("payload length in this non-WS context: ", ws_message().length(), "\n");