websocket.receive
Wait until a message has been received from this websocket.
|
|||
Opens a websocket to an echo server, sends a message and waits for the response. | |||
Code | <nowiki>
local ws, err = http.websocket("wss://echo.websocket.org")
if ws then
ws.send("Hello")
print(ws.receive())
ws.close()
end
</nowiki>
|
||
Output | <nowiki>Hello</nowiki>
|
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
websocket.receive Function | |
---|---|
Syntax websocket.receive() | |
Returns | string |
API | http |
Source | CC:Tweaked (source) |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.