key=assert(settings.get"krist.pkey","please set private key") sres =textutils.unserializeJSON( http.post("https://krist.dev/ws/start","privatekey="..key).readAll()) assert(sres.ok,"not ok") ws = assert(http.websocket(sres.url)) nextid = 0 function sendws(t) t.id = nextid nextid = nextid + 1 return ws.send(textutils.serializeJSON(t)) end sendws {type="me"} while true do msgtxt = assert(ws.receive(),"ws error") msg = textutils.unserializeJSON(msgtxt) if msg.type ~= "keepalive" then print(msgtxt) end end -- mtop = peripheral.wrap"top" -- while true do -- mtop.setTextScale(3.5) -- mtop.setTextColor(colors.cyan) -- mtop.setCursorPos(1,1) -- mtop.write"DIAMONDS" -- os.sleep(0.75) -- mtop.clear() -- os.sleep(0.25) -- mtop.setTextScale(3) -- mtop.setTextColor(colors.white) -- mtop.setCursorPos(1,1) -- mtop.write("5KST EACH") -- os.sleep(0.75) -- mtop.clear() -- os.sleep(0.25) -- end