From 279e87af49c103eb0b9278e10dc4a16b3a547f69 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 29 Dec 2022 20:27:54 +0000 Subject: shop --- shop.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shop.lua b/shop.lua index ad6e425..ecd0d0f 100644 --- a/shop.lua +++ b/shop.lua @@ -2,6 +2,14 @@ sres =textutils.unserializeJSON( http.post("https://krist.dev/ws/start","").read 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 +end +sendws { type="get_subscription_level" } while true do msgtxt = assert(ws.receive(),"ws error") -- cgit v1.2.3