Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JSON = (loadfile "json.lua")()
- local function handleResponse(res)
- if (res == nil) then
- return
- end
- if(res.res == "test") then
- print("test")
- end
- end
- local function main()
- local ws, err = http.websocket("ws://localhost:3000");
- if(ws == false) then
- print(err)
- return
- end
- while true do
- local msg = ws.receive()
- local json = JSON:decode(msg)
- handleResponse(json)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement