Skip to content

Conversation

@DanTup
Copy link
Contributor

@DanTup DanTup commented Mar 12, 2025

My recent change to disable the SSE connection when running embedded had an unintended side-effect. There's a number of places that check isDevToolsServerAvailable to see if they can call the HTTP API (and to set up server-side storage), however this was checking whether the SSE connection was made, not only that the server was available.

This change moves the server API check out of DevToolsServerConnection (which is basically the SSE API) and sets the storage (and therefore isDevToolsServerAvailable) based on just the HTTP API regardless of SSE, and then only attempts to connect SSE after.

Fixes #9023

My recent change to disable the SSE connection when running embedded had an unintended side-effect. There's a number of places that check `isDevToolsServerAvailable` to see if they can call the HTTP API (and to set up server-side storage), however this was checking whether the SSE connection was made, not only that the server was available.

This change moves the server API check out of `DevToolsServerConnection` (which is basically the SSE API) and sets the storage (and therefore `isDevToolsServerAvailable`) based on just the HTTP API regardless of SSE, and then only attempts to connect SSE after.

Fixes flutter#9023
@DanTup DanTup requested a review from kenzieschmoll March 12, 2025 13:00
@DanTup DanTup requested a review from a team as a code owner March 12, 2025 13:00
Comment on lines 38 to +42
/// Since the DevTools server is a web server, it is only available for the
/// web platform.
///
/// TODO(dantup): Since this relates only to non-SSE API, it could be available
/// for non-web?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure of the logic behind this comment, but wonder if maybe it was because of SSE (and maybe package:sse only worked for web?). I feel like we should (in theory) be able to run the server and connect a desktop version of DevTools to it, which makes this comment incorrect?

@DanTup DanTup merged commit c4bd441 into flutter:master Mar 12, 2025
41 checks passed
@DanTup DanTup deleted the change-server-api-checl branch March 12, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--dtd-uri (and server-provided storage) doesn't work with "dt serve" when embedded when SSE connection is disabled

2 participants