Check availability
Web terminals currently support AWS labs only. Show the terminal action for labs withprovider: 'aws' and webTerminal: true.
The environment must also be ready. If an Azure lab enables its terminal indicator, session creation still returns TERMINAL_NOT_SUPPORTED.
The server can still reject a session because the lab ended or the terminal service is unavailable. A content indicator is not authorization.
Create a session on the server
- Resolve the current learner session.
- Check that the deployment belongs to that session.
- Create temporary credentials:
- Return
sessionto that learner withCache-Control: no-store.
wsUrl, protocols, and expiresAt. It contains no organization API key.
The SDK retries CONTAINER_STARTING every two seconds, for up to 30 seconds. Other terminal failures do not use that startup loop.
Connect the browser
getSession() represents a request to your own server integration. Its route and session checks belong to your application.
screen, showConnectionState, showExit, and showConnectionError represent your UI code. The helper does not require a framework or terminal renderer.
The browser helper reference includes an xterm example and all callback types.
Input and resize
After readiness, send keyboard input withwrite():
Uint8Array values.
Reconnect and close
When the learner requests a reconnect, callreconnect():
onError callback does not handle those promise rejections.
Use onStateChange to handle a closed connection. After readiness, an ordinary socket close reports closed without calling onError.
When your terminal view closes, call dispose():
deployment.destroy().
Expiration and errors
expiresAt is the deadline for connection authorization. It is not the shell lifetime or deployment deadline.
An existing connection can continue after token expiration until the lab ends. A reconnect requires fresh credentials.
An ended lab cannot create a new terminal session. A reconnect can also fail because terminal support is disabled or the service is unavailable.
Show these failures in the terminal view. A new lab launch requires a separate learner action.
The WebSocket protocol documents the wire format for direct clients.