File tree Expand file tree Collapse file tree
packages/devtools_app/lib/src/shared
config_specific/framework_initialize Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,12 +28,15 @@ Future<String> initializePlatform() async {
2828 );
2929
3030 // TODO(kenz): this server connection initialized listeners that are never
31- // disposed, so this is likely leaking resources.
31+ // disposed, so this is likely leaking resources.
3232 // Here, we try and initialize the connection between the DevTools web app and
3333 // its local server. DevTools can be launched without the server however, so
3434 // establishing this connection is a best-effort.
35- // TODO(kenz): investigate it we can remove the DevToolsServerConnection
36- // code in general. We do not appear to be using the SSE connection.
35+ // TODO(kenz): investigate if we can remove the DevToolsServerConnection
36+ // code in general - it is currently only used for non-embedded pages to
37+ // support some functionality like having VS Code reuse existing browser tabs
38+ // and showing notifications if you try to launch when you already have one
39+ // open.
3740 final connection = await DevToolsServerConnection .connect ();
3841 if (connection != null ) {
3942 setGlobal (Storage , server.ServerConnectionStorage ());
Original file line number Diff line number Diff line change 55import 'dart:async' ;
66import 'dart:convert' ;
77
8+ import 'package:devtools_app_shared/ui.dart' show isEmbedded;
89import 'package:devtools_shared/devtools_shared.dart' ;
910import 'package:flutter/foundation.dart' ;
1011import 'package:http/http.dart' as http;
@@ -47,6 +48,14 @@ class DevToolsServerConnection {
4748 : baseUri.resolve ('api/' );
4849
4950 static Future <DevToolsServerConnection ?> connect () async {
51+ // Don't connect SSE when running embedded because the API does not provide
52+ // anything that is used when embedded but it ties up one of the limited
53+ // number of connections to the server.
54+ // https://github.com/flutter/devtools/issues/8298
55+ if (isEmbedded ()) {
56+ return null ;
57+ }
58+
5059 final serverUri = Uri .parse (devToolsServerUriAsString);
5160 final apiUri = apiUriFor (serverUri);
5261 final pingUri = apiUri.resolve ('ping' );
You can’t perform that action at this time.
0 commit comments