socket.lua

os.loadAPI("./LuaUtils.lua")
local ws,err = http.websocket("ws://c58a90595815.ngrok.io")

if ws then
    while true do
        write("WSS>> ")
        local command = read()
        if string.find( command, "@coin" ) then
            ws.send(command)
            local message,binary = ws.receive()
            local data = string.split(message,",")
            print(data)
            print("Coin Data:")
            print("User: "..data[1].."/ Coins: "..data[2])
        end
    end
    
    ws.close()
end