Posted 20 June 2017 - 02:07 AM
Welcome to ccnet!
This is a spinoff of the endernet mod, written fully in lua and node (for the server)!
With this utility, you can connect to a communication server to facilitate messages from anywhere to anywhere. Clients can be written for in-game computers as well as real computers (JS api to come), and because it uses an external HTTP server, there is infinite range, no modem required, and the computers don't even have to be on the same server!
Uses:
- Long-distance communication without repeaters
- Cross-dimensional communication
- Weather-independent communication
- Communication with programs and web apps
- Could be especially useful for ssh by connecting computers within ccemu to in-game computers on servers
How it works:
- In-game computers connect to http server
- http server stores response methods for use later
- Client connects to server and sends message to a topic
- Server looks topic up in it's object and sends message to each client in the array
- Server returns number of clients that were connected (theoretical; disconnected clients are still in the array)
- –To use in your program, the following lines must be added. –os.loadAPI("endernet") –os.pullEvent = endernet.middle –os.pullEventRaw = endernet.middleRaw – –This API exposes the following methods (NOTE: all topics MUST begin with "/", otherwise they will be dropped with 404 error code) –send(string topic, string message) –Sends a message to the specified topic –Returns maximum number of possibly connected clients (Not all that useful, but can be informative) –subscribe(string topic) –Subscribes to a topic in order to receive messages from it –Returns nil –assert(string topic) –Asserts a topic, renewing a request in case its connection is dropped –unsubscribe(string topic) –Unsubscribes from a topic –Returns nil –receive() –Receives message from any of the subscribed topics –Returns topic, message –middle(event) –Meant to replace os.pullEvent, and handles http events in order to keep them alive –middleRaw(event) –Same as above, for os.pullEventRaw
- API: pastebin get f5eHM6ie (https://pastebin.com/f5eHM6ie)
- Demo Server: ccnet.herokuapp.com
- Server: https://github.com/sploders101/ccnet
Edited on 24 June 2017 - 04:19 PM