Skip to content

Commit b5600fe

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

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/modules/http.websocket.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ 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+
```lua
57+
local ws = websocket.new_from_uri("wss://echo.websocket.org")
58+
assert(ws:connect())
59+
60+
for data, opcode in ws:each() do
61+
print(data, opcode)
62+
end
63+
64+
```
5665

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

0 commit comments

Comments
 (0)