Run gotty as a library. Cast your current running go program to the web!
makewhich will make libgotty.so.
See ./example/main.go for example usage, but the general idea is:
// capture all program i/o
io := libgotty.CaptureIO()
// start a web server to forward all i/o to the browser
go libgotty.Server(io,...)The key is that you can call captureIO/serve to display in the webserver, then later on release the capture. YOu don't have to commit the entire program to the browser like you would by using gotty. You don't have to commit to displaying on the browser at the program level. For example you could parse some args like
$my_program --web-versionand only afterwards display on the web.
Or you can do some secure setup before hand in the terminal, then afterwards do the rest in the web. Etc.
If you don't need to resume your program after running on the web, it is probably better to use embedgotty.