This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
justync7's profile picture

rednoot - A global rednet/modem bridge.

Started by justync7, 30 April 2017 - 07:10 PM
justync7 #1
Posted 30 April 2017 - 09:10 PM
rednoot is a bridge between rednet or modem and a websocket server, this allows for cross server and cross emulator connections.
Requirements:
- Latest CCEmuX or CCTweaks or CCTweaks Patched CCEmuRedux
- Sockets enabled in the CCTweaks config.

Download:

wget https://raw.githubusercontent.com/justync7/rednoot/master/client.lua rednoot

Simple usage:

rednoot

Advanced usage (parentheses are defaults):

rednoot [endpoint (ws://rednoot.krist.club)] [mountPoint (front)]

It's as simple as connecting on your desired computers, and the rednet and modem connections on the "front" will be bridged magically over the internet!

Additional info:
More information about this, such as hosting your own bridge and the specifications on how this is implemented can be found on the repo: https://github.com/justync7/rednoot

DISCLAIMER:
This is not perfect, and you might run into bugs at times. Simply report them to me and I will attempt to solve them.
Edited on 30 April 2017 - 10:53 PM
SquidDev #2
Posted 30 April 2017 - 09:15 PM
Looks cool. Glad to see someone putting CCTweaks to good use. One thing you should be able to do is wait for the socket_connected event instead of polling to check it's open:


local timeout = os.startTimer(10)
while true do
  local ev, id = os.pullEvent()
  if ev == "socket_connected" and id == ws.id() then
    break
  elseif ev == "timer" and id == timeout then
    printError("Timed out")
    return
  end
end
Note, I haven't actually tested that.
justync7 #3
Posted 30 April 2017 - 09:59 PM
Looks cool. Glad to see someone putting CCTweaks to good use. One thing you should be able to do is wait for the socket_connected event instead of polling to check it's open:


local timeout = os.startTimer(10)
while true do
  local ev, id = os.pullEvent()
  if ev == "socket_connected" and id == ws.id() then
	break
  elseif ev == "timer" and id == timeout then
	printError("Timed out")
	return
  end
end
Note, I haven't actually tested that.
Thanks for that! I have simplified the code significantly now.
Edited on 30 April 2017 - 07:59 PM