Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local key = settings.get "govos.key"
- if not key then error "GovOS RDS key not found." end
- local ws, err = http.websocket("wss://osmarks.tk/wsthing/GovOS/admin", {
- authorization = "Key " .. key
- })
- if err then
- error(err)
- else
- print "Connected"
- end
- function readWS()
- while true do
- print(ws.receive())
- end
- end
- function send(msg)
- local ok = pcall(ws.send, msg)
- if not ok then
- print "Disconnected"
- connect()
- send(msg)
- end
- end
- function writeWS()
- local hist = {}
- while true do
- write "|> "
- local input = read(nil, hist)
- table.insert(hist, input)
- send(input)
- end
- end
- parallel.waitForAll(writeWS, readWS)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement