local connectionUrl = "wss://mppclone.com"; local ws, err = http.websocket(connectionUrl) if not ws then return printError(err) end function send(data) local message = {} message[1] = data; ws.send(textutils.serialiseJSON(message)); end local function tSender() while true do os.sleep(15) send({ m = "t" }) end end local function pollWebsocket() while true do local _, url, response, isBinary = os.pullEvent("websocket_message"); if url == connectionUrl then local json = textutils.unserializeJSON(response); if json[1].m == "b" then print("Connected to MPP!"); send({ m = "hi", token = "" }) end if json[1].m == "hi" then print("Authenicated!") send({ m = "ch", _id = "The Roleplay Room" }) end if json[1].m == "a" then print("["..json[1].p._id:sub(0, 6).."] "..json[1].p.name..": "..json[1].a) end local g = json[1].m == "m" or json[1].m == "n" if not g then print(json[1].m) end end end end parallel.waitForAny(tSender,pollWebsocket)