Skip to content

Commit d06eb6e

Browse files
author
hollunder
committed
doc/modules/http.websocket.md: Add usage example to websocket:each()
1 parent 921e04d commit d06eb6e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/modules/http.websocket.md

+10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ The opcode `0x1` will be returned as `"text"` and `0x2` will be returned as `"bi
5353

5454
Iterator over [`websocket:receive()`](#http.websocket:receive).
5555

56+
#### Example {#http.websocket:each-example}
57+
58+
```lua
59+
local ws = websocket.new_from_uri("wss://echo.websocket.org")
60+
assert(ws:connect())
61+
62+
for data, opcode in ws:each() do
63+
print(data, opcode)
64+
end
65+
```
5666

5767
### `websocket:send_frame(frame, timeout)` <!-- --> {#http.websocket:send_frame}
5868

0 commit comments

Comments
 (0)