Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- json = require "json"
- local ws, err = http.websocket("ws://localhost:8080")
- if err then
- print(err)
- elseif ws then
- print("> CONNECTED")
- ws.send("Hi")
- while true do
- local message = ws.receive()
- local obj = json.decode(message)
- print(obj.content)
- end
- ws.close()
- end
Add Comment
Please, Sign In to add comment