Skip to content

Rename WebSocketDataCallback's frame param from opcode to bits - #9

Open
heshammahamed wants to merge 1 commit into
masterfrom
docs/websocket-bits-opcode
Open

Rename WebSocketDataCallback's frame param from opcode to bits#9
heshammahamed wants to merge 1 commit into
masterfrom
docs/websocket-bits-opcode

Conversation

@heshammahamed

Copy link
Copy Markdown
Contributor

The parameter was named opcode, but civetweb actually passes the raw first byte of the WebSocket frame header (FIN flag + reserved bits + the real opcode packed into the low 4 bits), not the opcode alone. Renamed to bits to match civetweb's own naming, and updated the docs (EN + AR) and examples to match this correct understanding.

The parameter was named `opcode`, but civetweb actually passes the raw
first byte of the WebSocket frame header (FIN flag + reserved bits +
the real opcode packed into the low 4 bits), not the opcode alone.
Renamed to `bits` to match civetweb's own naming, and updated the
docs (EN + AR) and examples to match this correct understanding.
@heshammahamed
heshammahamed requested a review from sarmadka August 25, 2026 15:42
@sarmadka

sarmadka commented Sep 1, 2026

Copy link
Copy Markdown
Member

Where did you get that info about Civetweb from, and is their documentation wrong? In their documentation the mg_websocket_data_handler function type has the second param named opcode.
https://github.com/civetweb/civetweb/blob/master/docs/api/mg_set_websocket_handler.md

@heshammahamed

Copy link
Copy Markdown
Contributor Author

I think this is a problem in their Docs.

this is from civetweb's own header :

mg_websocket_data_handler
Is called when a data frame has been received from the client.
Parameters:
bits: first byte of the websocket frame, see websocket RFC at
http://tools.ietf.org/html/rfc6455, section 5.2
data, data_len: payload, with mask (if any) already applied.
Return value:
1: keep this websocket connection open.
0: close this websocket connection.

search on it in this file to make sure : https://github.com/civetweb/civetweb/blob/master/include/civetweb.h

@heshammahamed
heshammahamed requested review from sarmadka and removed request for sarmadka September 8, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants