Skynet - Simple Communication Over Websocket

Started by osmarks, Oct 06, 2018, 02:05 PM

Previous topic - Next topic

osmarks

Skynet is a library for simple, rednet-like communication, over websockets. This means that it is cross-server, doesn't need a modem, and has a few nice extra features like logs of past messages. It does, however, need to connect to my (or another) out-of-game server to work.
Requires CC: Tweaked.

Usage information:
local skynet = require "skynet"
skynet.send(channel, message) -- send the given message on the given channel
skynet.receive(channel) -- receive a message on the given channel - returns channel, message, metadata
skynet.listen() -- run in parallel with program - converts websocket messages to skynet_message events with the same data as skynet.receive
skynet.disconnect() -- close websocket/stop receiving messages
skynet.logs() -- get message logs - returns a table of message objects, newest first

View the server and client code at github.
Download the client with wget https://raw.githubusercontent.com/osmarks/skynet/master/client.lua skynet.
View and send messages with this convenient web client.

If you want to do something fancy/advanced (connect to skynet outside of CC, run/use your own server, etc), please contact me - either here, or on Hydronitrogen's ComputerCraft discord, or on SwitchCraft (or its discord).

osmarks

This has recently been updated and I forgot to mention it earlier. logs no longer works due to a rewrite of the server.