diff options
author | ubq323 <ubq323@ubq323.website> | 2022-12-29 21:29:32 +0000 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2022-12-29 21:29:32 +0000 |
commit | b1f4f2b71d5a62b1807cae591fd8cb165e953a8f (patch) | |
tree | a61605b53b672387aaedb6394446bd23043dd115 | |
parent | 39dc2d2d8b82ace72277e2fdec0870df54a21303 (diff) |
shop
-rw-r--r-- | shop.lua | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -4,18 +4,30 @@ assert(sres.ok,"not ok") ws = assert(http.websocket(sres.url)) nextid = 0 +our_addr = "???" function sendws(t) t.id = nextid nextid = nextid + 1 return ws.send(textutils.serializeJSON(t)) end -sendws {type="me"} + +function parsetrans() while true do msgtxt = assert(ws.receive(),"ws error") msg = textutils.unserializeJSON(msgtxt) if msg.type ~= "keepalive" then print(msgtxt) end + if msg.type == "response" and msg.responding_to_type == "me" then + our_addr = msg.address.address + local m = peripheral.wrap"left" + m.setCursorPos(1,1) + m.write(our_addr) + end + if msg.type == "event" and msg.event == "transaction" then + print("trans") + + end end |