UCE Docs / ws_opcode

Signature

u8 ws_opcode()

Parameters

return value : opcode of the current WebSocket message

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");
Output
opcode: 0 (0 outside a WS frame)