Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subcommand for 'start-session' #983

Open
adamchalmers opened this issue Oct 22, 2024 · 0 comments
Open

Subcommand for 'start-session' #983

adamchalmers opened this issue Oct 22, 2024 · 0 comments

Comments

@adamchalmers
Copy link
Contributor

Problem

Repeatedly executing KCL in the terminal is slow, because each time you execute KCL you have to establish a new connection to the engine via api-deux. This adds latency.

Solution

Start a modeling session with the engine, and keep it alive across multiple KCL programs. Just clear the scene between executing each KCL program.

The start-session command connects the CLI to the engine API via WebSocket. It then opens a tiny HTTP server on localhost (:3333 by default, but configurable) which accepts KCL programs in HTTP bodies. When it receives an HTTP request on that port, it executes the KCL program on the engine. It responds to the HTTP request with either a PNG screenshot, or an error.

This command is nearly ready, it's just got one problem. Right now api-deux times out WebSockets after 30 seconds of idle time. This is OK in the modeling app because users won't be idle for >30s, and if they are, the app reconnects them automatically. But it's not OK for this terminal or testing workflow. So the api-deux timeout should be increased, I'd suggest 5 minutes.

adamchalmers added a commit that referenced this issue Oct 22, 2024
Until it's ready. See #983
adamchalmers added a commit that referenced this issue Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant