gravitowl

startup

Mar 6th, 2021 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. json = require "json"
  2. local ws, err = http.websocket("ws://localhost:8080")
  3.  
  4. if err then
  5. print(err)
  6.  
  7. elseif ws then
  8. print("> CONNECTED")
  9. ws.send("Hi")
  10.  
  11. while true do
  12. local message = ws.receive()
  13. local obj = json.decode(message)
  14.  
  15. print(obj.content)
  16. end
  17. ws.close()
  18. end
Add Comment
Please, Sign In to add comment