Open a raw TCP or UDP connection to a port
A WebSocket upgrade (RFC 6455) whose binary frames are the bytes of one TCP connection to the port, each way.
A WebSocket upgrade (RFC 6455) whose binary frames are the bytes of one TCP connection to the port, each way. With protocol=udp each binary frame is one datagram instead. mpod sandboxes ports forward and an SSH ProxyCommand are built on it. A text frame from the client ends the connection. The port is connected before the upgrade, so a port nothing listens on answers port_closed instead of a socket. A sleeping sandbox is woken first, waiting up to 30 seconds (not_ready after). An open connection is checked again every 30 seconds and closed once its key is revoked or loses sandboxes:exec. A key sends Authorization, as on every call; a browser has no use for raw bytes, so no stream ticket opens it.
A key with the sandboxes:exec scope.
Request
A WebSocket. Open the stream_url the command's answer gives, with your key in Authorization; a browser opens it with a stream ticket instead. The SDKs open it for you.
Parameters
| Name | In | Type | Required | What it is |
|---|---|---|---|---|
sandbox_id | path | string | Yes | |
port | path | integer | Yes | A TCP or UDP port number, 1 to 65535. |
protocol | query | "tcp" | "udp" | No |
Errors
The refusals this call is known for: invalid, port_closed, not_ready, not_found, in_other_cell. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.
In the SDKs
| Client | Call |
|---|---|
| TypeScript | pod.ports.connect(sandboxId, port) |
| Python | pod.ports.connect(sandbox_id, port) |