some cleanup
This commit is contained in:
+15
-7
@@ -12,7 +12,7 @@ Defines the WebSocket message handler for the current `.ws.uce` page.
|
||||
|
||||
The same page may expose both `RENDER(Request& context)` and `WS(Request& context)`. `RENDER(Request& context)` serves the initial HTTP response, while `WS(Request& context)` is called whenever a complete WebSocket message arrives for that page.
|
||||
|
||||
UCE reassembles fragmented messages before calling `WS(Request& context)`. Text and binary frames are both delivered. Use `context.call`, `context.connection`, `ws_opcode()`, and `ws_is_binary()` to inspect the current message.
|
||||
UCE reassembles fragmented messages before calling `WS(Request& context)`. Text and binary frames are both delivered. The current payload is available directly on `context.in`, message metadata is mirrored into `context.params["WS_..."]`, and connection-local state lives on `context.connection`.
|
||||
|
||||
## Connection State
|
||||
|
||||
@@ -20,13 +20,21 @@ UCE reassembles fragmented messages before calling `WS(Request& context)`. Text
|
||||
|
||||
## Message Data
|
||||
|
||||
The current message data is available in `context.call`:
|
||||
The current message payload is available as:
|
||||
|
||||
- `context.call["message"]`: current message payload
|
||||
- `context.call["connection_id"]`: sender connection ID
|
||||
- `context.call["scope"]`: current endpoint scope
|
||||
- `context.call["opcode"]`: WebSocket opcode of the current message
|
||||
- `context.call["document_uri"]`: request URI of the current endpoint
|
||||
- `context.in`: current WebSocket payload
|
||||
- `context.params["WS_MESSAGE"]`: same payload mirrored into the parameter map
|
||||
|
||||
The current message metadata is available as:
|
||||
|
||||
- `context.params["WS_CONNECTION_ID"]`: sender connection ID
|
||||
- `context.params["WS_SCOPE"]`: current endpoint scope
|
||||
- `context.params["WS_CONNECTION_COUNT"]`: number of currently connected clients in that scope
|
||||
- `context.params["WS_OPCODE"]`: WebSocket opcode of the current message
|
||||
- `context.params["WS_MESSAGE_TYPE"]`: `TEXT` or `BINARY`
|
||||
- `context.params["WS_DOCUMENT_URI"]`: request URI of the current endpoint
|
||||
|
||||
Helper wrappers such as `ws_message()`, `ws_connection_id()`, `ws_scope()`, `ws_connection_count()`, `ws_opcode()`, and `ws_is_binary()` are still available when that reads better for the handler.
|
||||
|
||||
## Related Concepts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user