ComputerCraft Forums

ComputerCraft => Programs => APIs and Utilities => Topic started by: osmarks on Oct 06, 2018, 02:05 PM

Title: Skynet - Simple Communication Over Websocket
Post by: osmarks on Oct 06, 2018, 02:05 PM
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 (https://github.com/osmarks/skynet).
Download the client with wget https://raw.githubusercontent.com/osmarks/skynet/master/client.lua skynet.
View and send messages with this convenient web client (https://osmarks.tk/skynet/).

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).
Title: Skynet - Simple Communication Over Websocket
Post by: osmarks on Feb 10, 2019, 07:59 PM
This has recently been updated and I forgot to mention it earlier. logs no longer works due to a rewrite of the server.