changing doc format and HTML literals
This commit is contained in:
+14
-6
@@ -1,15 +1,25 @@
|
||||
:title
|
||||
WS
|
||||
|
||||
:sig
|
||||
WS(Request& context)
|
||||
|
||||
:desc
|
||||
:see
|
||||
>websocket
|
||||
|
||||
:content
|
||||
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.
|
||||
|
||||
## Connection State
|
||||
|
||||
`context.connection` is a broker-owned `DTree` for the current socket. It starts empty for a new client and persists across later `WS(Request& context)` calls on that same connection.
|
||||
|
||||
## Message Data
|
||||
|
||||
The current message data is available in `context.call`:
|
||||
|
||||
- `context.call["message"]`: current message payload
|
||||
@@ -18,9 +28,7 @@ The current message data is available in `context.call`:
|
||||
- `context.call["opcode"]`: WebSocket opcode of the current message
|
||||
- `context.call["document_uri"]`: request URI of the current endpoint
|
||||
|
||||
:related
|
||||
**PHP:** Ratchet `onMessage`, Workerman WebSocket handlers, or lower-level callbacks around accepted socket connections.
|
||||
**JavaScript / Node.js:** Browser `WebSocket` `message` handlers and Node `ws` server `connection` and `message` callbacks.
|
||||
## Related Concepts
|
||||
|
||||
:see
|
||||
>websocket
|
||||
- PHP: Ratchet `onMessage`, Workerman WebSocket handlers, or lower-level callbacks around accepted socket connections
|
||||
- JavaScript / Node.js: browser `WebSocket` `message` handlers and Node `ws` server `connection` and `message` callbacks
|
||||
|
||||
Reference in New Issue
Block a user