From d06eb6ee3503a990b8e4c27a96722ee12265f229 Mon Sep 17 00:00:00 2001 From: hollunder Date: Thu, 19 Jul 2018 10:38:39 +0200 Subject: [PATCH] doc/modules/http.websocket.md: Add usage example to websocket:each() --- doc/modules/http.websocket.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/modules/http.websocket.md b/doc/modules/http.websocket.md index 18498c98..e9e0ce63 100644 --- a/doc/modules/http.websocket.md +++ b/doc/modules/http.websocket.md @@ -53,6 +53,16 @@ The opcode `0x1` will be returned as `"text"` and `0x2` will be returned as `"bi Iterator over [`websocket:receive()`](#http.websocket:receive). +#### Example {#http.websocket:each-example} + +```lua +local ws = websocket.new_from_uri("wss://echo.websocket.org") +assert(ws:connect()) + +for data, opcode in ws:each() do + print(data, opcode) +end +``` ### `websocket:send_frame(frame, timeout)` {#http.websocket:send_frame}