Has anybody already implemented this? I'm getting stuck right now and would really appreciate if somebody can give me some help.
Basically I want to stream a bash shell inside a Docker container to the browser via websockets.
In short I have a handler that listens for a websocket connection and it then starts two goroutines that are copying data sent from the browser and to the stdin of a exec.Command("docker", "exec", "-i", "id", "/bin/sh" and in reverse (from stdout to the websocket). If I test in the browser console it works. I can send a command likews.send("ls") and it returns successfully. When connecting that same endpoint to xterm.js nothing works as expected. There might be a problem with my xterm.js setup so don't bother with that. I will spend some more time on that. I just want to make sure on how would you go about doing that.
I realize this is a broad question, but if anyone has any suggestions on how to approach this, I’d really appreciate it.
Below is the main code (in case somebody will skim through it):