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

21 lines
431 B
Plaintext

:sig
u8 ws_opcode()
:params
return value : opcode of the current WebSocket message
:see
>websocket
:content
Returns the opcode of the message currently being handled by `WS(Request& context)`.
Common values are:
- `0x1` for text messages
- `0x2` for binary messages
:example
// ws_opcode() returns the WebSocket frame opcode (1 text, 2 binary, 8 close, ...).
print("opcode: ", (u64)ws_opcode(), " (0 outside a WS frame)\n");