It can be added to any application to provide such a service independent of what the rest of the application is doing: gui, webserver, etc.
To start listening for remote sessions, use:
Connect start port => listen on the specified port Connect stop => stop listening for remote sessions
Whenever a remote connection is started, an application-level event is fired:
Rig notify connect.Session open
When the connection is closed, the event fired becomes:
Rig notify connect.Session close
To accept connections right after application launch, add this to your code:
Rig hook main.Run { Connect open 2323 }
Only a single remote connection can be open at a time. While the remote session exists, all app output to stdout and stderr will be redirected to that session.
Connect start port ?iface?
Start a new server, listening on the specified port.
The optional interface argument can be specified to limit on which interface this server will listen. Since opening up such a server to public access is a security risk, the default allows connections only from the same machine. Change this to "0.0.0.0" for worldwide access, but beware...
Connect stop
Stop the remote session and restore stdout/stderr handling to normal.