Skip to main content

Server session methods

All configuration fields are optional. The defaults are a two-second interval and a 30-second startup deadline. Only CONTAINER_STARTING triggers the startup loop. Cancellation produces aborted. The deadline produces timeout.
The SDK normalizes an absent REST protocols field to an empty array. It rejects malformed or expired session responses. Both helpers require wss: URLs. Local development also permits ws: for localhost, 127.0.0.1, and [::1]. The REST operation defines server errors.

Browser entry point

This entry point contains no server client and accepts no organization API key. The SDK includes dist/terminal.js as a standalone browser ESM build. The public SDK package is coming soon. Its installation instructions will appear when the package is available.

Configuration and callbacks

Only getSession is required. States are idle, connecting, ready, closed, and disposed.

Controller methods

The helper retains the latest dimensions until readiness. It prevents stale session requests from reopening a disposed terminal. The helper does not automatically reconnect, replay input, or end a deployment. Handle rejections from connect() and reconnect(), even with an onError callback. Replacement and disposal reject a pending connection promise. After readiness, a socket close reports closed through onStateChange. It does not call onError for an ordinary close. A disposed controller cannot reconnect. Create another controller for a new terminal view. write() discards input before readiness or after closure. resize() clamps whole-number dimensions to 1 through 500 and rejects non-finite numbers.

xterm integration

This example assumes screen is an open xterm instance. getSession is your application callback:
The UI can use the state callback to disable input before readiness. Reconnect controls call terminal.reconnect(). The terminal guide explains session ownership and expiration.