Open terminal session (WebSocket)
Open an interactive terminal (shell) session to a running application process.
This is a WebSocket endpoint. Connect using a WebSocket client with the Upgrade: websocket header. Standard HTTP requests return a 426 Upgrade Required response.
Connection
Authentication runs before the WebSocket upgrade - invalid credentials are rejected with a standard HTTP 401/403 response.
Communication
Once connected, the WebSocket streams stdin/stdout bidirectionally to a shell running inside the container. Send text messages as shell input and receive command output as text messages.
Terminal size
The terminal starts at the size given by the cols and rows query parameters, or 80x24 without them. To resize it, send a binary message holding the UTF-8 encoded JSON {"type":"resize","cols":120,"rows":40}. Sizes are clamped to 2-500 columns and 2-200 rows, and a resize message without integer cols and rows is ignored. Resize messages never reach the shell. Text messages are always shell input, even when they look like a resize message, and any other binary message is passed to the shell as input as well.
Environment
The shell starts with TERM=xterm-256color and COLORTERM=truecolor. It also gets LANG=C.UTF-8, unless the container already sets LANG or an LC_* variable.
Output
Output arrives as UTF-8 text messages. A character that the container writes in two pieces is always sent whole, never as a replacement character.
Keepalive
The server sends a WebSocket ping every 25 seconds, which standard WebSocket clients answer with a pong on their own. This keeps an idle session open through proxies and load balancers. A connection that leaves two pings in a row unanswered is closed, and so is a session that has had no input and no output for 8 hours.
Disconnects
A closed connection is not resumed, and the next connection starts a new shell. Run long jobs under nohup, or in tmux or screen when the image has them, so you can find them again after a disconnect.
Close codes
4000- Application or process not found4001- No running pod available to connect to4002- Shell stream error4003- Shell stream closed normally4004- No input and no output for 8 hours4005- Failed to connect to the pod4300- Unexpected server error