Join a command's terminal (WebSocket)
A WebSocket to a command started with tty. OpenAPI cannot describe the messages; x-websocket lists them. Binary messages are bytes: what is typed one way, what the terminal shows the other. Text messages are JSON: the client sends TerminalResize and TerminalSignal; the server sends TerminalExit when the command ends, or TerminalError when it was lost, and then closes with code 1000, and TerminalGap before what it shows next where the client fell behind by more than the sandbox keeps of the output (what it shows carries no position, and a client that counts it, to join again with from, goes on from there). A sandbox moved to another node meanwhile ends it with TerminalError sandbox_moved (where it went, and offset, the position shown up to) and the close code 1012 with the reason sandbox_moved: the command goes on there, and the terminal is joined again through the control plane with from set to offset. The server pings after 20 seconds of silence. Leaving does not end the command: join again, and the last 64 KiB of what the terminal showed come first (or everything from from). An open terminal keeps nothing awake; the next key wakes a sandbox that sleeps. A browser, which cannot set headers on a WebSocket, passes a sandbox token with scope tty as sandbox_token. A command that was not started with tty can be joined as well: its output arrives as binary messages.
Its messages are in Event streams and terminals.
Takes tty, or a token of the sandbox with tty.
https://api.glac.ai/v1/sandboxes/{id}/exec/{exec_id}/ttyOtorisasi
Parameter path
Parameter query
Parameter header
Returns
101
The connection is a WebSocket from here on.
400
The request is not one this call takes. unknown_parameter: the query has a parameter this call does not take; websocket_expected: the request is not a WebSocket upgrade; invalid_field: a field or query parameter has the wrong type or is out of range.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
401
missing_api_key, invalid_api_key, expired_api_key, invalid_token.
403
The credential may not do this. token_scope: the sandbox token lacks the scope. spend_limit_reached: the sandbox is frozen because a spend limit was reached; it sleeps, with its data, until the limit is raised.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
404
Something the request names does not exist. sandbox_not_found: no such sandbox; exec_not_found: no such command in the sandbox.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
409
The state of something stands in the way. sandbox_failed: the sandbox is failed.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.
default
Any other failure, in the same shape. internal (500): the node failed; the message says no more, and the node's log has the reason under the request's id. unavailable (503, retryable): no_capacity, every network slot of the node is in use; memory_full, a machine the call has to start (made, woken, booted from its disk, resumed, rolled back, built) does not fit in the host's memory beside what the machines that run on it are promised, and nothing paused or idle could be put to sleep to make room for it (memory of the node); drive_full, the call would have a template built and the node's data drive has no room for one (drive of the node); unavailable, the node is shutting down, the sandbox was still starting after 10 minutes, or it did not answer, or it is being moved to this node (with Retry-After: 1); fenced, the node's lease fences the sandbox (Node.lease). moved (409): the sandbox was moved to another node, which to names.
- exec_idoptionalstring
With
sandbox_movedofPOST …/run: the id of the command the call started and waited for, which goes on where the sandbox went: wait for it there through the control plane withGET …/exec/{exec_id}?wait_seconds=once the move is over. The same call made again starts the command a second time, unless it comes with the same Idempotency-Key.