summaryrefslogtreecommitdiff
path: root/listener.lua
diff options
context:
space:
mode:
Diffstat (limited to 'listener.lua')
-rw-r--r--listener.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/listener.lua b/listener.lua
new file mode 100644
index 0000000..efb3eef
--- /dev/null
+++ b/listener.lua
@@ -0,0 +1,19 @@
+local pm = require'pm'
+
+local ws = assert(http.websocket("wss://citrons.xyz/ws-echo/rebecca"))
+function main()
+ while true do
+ local msg = ws.receive()
+ local parsed = assert(textutils.unserializeJSON(msg))
+ if parsed.msg then
+ print("got msg",parsed.msg)
+ -- more sophisticated cmds later, maybe
+ local pkgname = parsed.msg
+ pm.dl(pkgname)
+ multishell.run(pkgname..'.lua')
+ end
+ end
+end
+
+pcall(main)
+print("all done")