# shell.session

How a terminal shell opens in a running replica.

- **Starts when:** You ask for a shell
- **Involved:** Your code, Dispra API, the replica
- **Ends with:** A shell in the replica, until you exit or it is idle for 10 minutes
- **Takes:** A second to connect

## Steps

| Step | Who | What | Calls / logs |
|---|---|---|---|
| 1 | Your code | Asks for a shell: Dispra answers a single-use ticket valid 5 minutes, and ws_url. | calls [Open a shell](https://docs.dispralabs.com/api/open-a-shell.md) |
| 2 | Your code | Opens a WebSocket to ws_url, without a browser Origin. |  |
| 3 | Dispra | Checks the ticket and connects it to one running replica of the service. |  |
| 4 | Your code | Sends keystrokes as binary frames and resize frames as text; the replica answers with its output. |  |

## Related

- [Terminal shell](https://docs.dispralabs.com/features/terminal-shell.md)
