Skip to content

Instantly share code, notes, and snippets.

@crohr
Last active January 22, 2024 08:25
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save crohr/ee30749b0f46844b86f5 to your computer and use it in GitHub Desktop.
Save crohr/ee30749b0f46844b86f5 to your computer and use it in GitHub Desktop.
Stream a tmux session in realtime over HTTP

On the server with tmux

Create a new tmux session:

tmux new-session -s my-session # launch `top`, `htop`, or anything that will regularly updates, then detach

Stream your session:

STREAM=$(curl -sX POST stream.chunk.io/streams)
echo $STREAM
socat EXEC:"tmux attach -t my-session",pty,stderr EXEC:"curl -T - $STREAM"

On the client(s)

curl --no-buffer $STREAM
@Starefossen
Copy link

If you get 411 Content Length Required error, retry the curl command with -d ''

STREAM=$(curl -sX POST -d '' stream.chunk.io/streams)

@MyLittleRunaway
Copy link

Is this possible with HTTPS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment