Skip to content

Comments

qt-cli, qt-core: Allow multiple qt-cli server instances#427

Merged
benchoq merged 1 commit intoqt-labs:devfrom
benchoq:ben-0223-qtcli-more-server-commands
Feb 24, 2026
Merged

qt-cli, qt-core: Allow multiple qt-cli server instances#427
benchoq merged 1 commit intoqt-labs:devfrom
benchoq:ben-0223-qtcli-more-server-commands

Conversation

@benchoq
Copy link
Collaborator

@benchoq benchoq commented Feb 24, 2026

This commit allows multiple REST server instances to run simultaneously, enabling multiple webviews that use qtcli to be opened in VSCode.

Add additional commands and options to the qtcli:

  • qtcli server start --socket
  • qtcli server stop all
  • qtcli server start --exit-on-idle
  • qtcli server start --exit-on-idle --heartbeat <duration, e.g. 10s, 500ms>
  • qtcli server ls

When --exit-on-idle is specified, the qtcli server will automatically close, unless it receives any request from the client within a specific timeout. Maximum idle time for the server will be three times the heartbeat duration.

This ensures that the qtcli server process is not left running without a client.

Webviews in qt-core have been updated to reflect these changes:

  • Webviews now generate a socket ID and pass it to qtcli.
  • QtcliRestClient posts /heartbeat requests to keep the server alive.
  • Add QtcliRestServer class to start qtcli with the proper arguments

Task-number: VSCODEEXT-289

@benchoq benchoq marked this pull request as draft February 24, 2026 11:15
@benchoq benchoq force-pushed the ben-0223-qtcli-more-server-commands branch 2 times, most recently from 3dfd121 to 2f05073 Compare February 24, 2026 11:32
This commit allows multiple REST server instances to run simultaneously,
enabling multiple webviews that use qtcli to be opened in VSCode.

Add additional commands and options to the qtcli:
- qtcli server start --socket <name>
- qtcli server stop all
- qtcli server start --exit-on-idle
- qtcli server start --exit-on-idle --heartbeat <duration, e.g. 10s, 500ms>
- qtcli server ls

When --exit-on-idle is specified, the qtcli server will automatically close,
unless it receives any request from the client within a specific timeout.
Maximum idle time for the server will be three times the heartbeat duration.

This ensures that the qtcli server process is not left running without a client.

Webviews in qt-core have been updated to reflect these changes:
- Webviews now generate a socket ID and pass it to qtcli.
- QtcliRestClient posts /heartbeat requests to keep the server alive.
- Add QtcliRestServer class to start qtcli with the proper arguments

Task-number: [VSCODEEXT-289](https://qt-project.atlassian.net/browse/VSCODEEXT-289)
@benchoq benchoq force-pushed the ben-0223-qtcli-more-server-commands branch from 2f05073 to 6015cd9 Compare February 24, 2026 12:34
@benchoq benchoq marked this pull request as ready for review February 24, 2026 12:43
@benchoq benchoq merged commit e8dfc07 into qt-labs:dev Feb 24, 2026
13 of 15 checks passed
@benchoq benchoq deleted the ben-0223-qtcli-more-server-commands branch February 24, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants