Unverified Commit f8135add authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

Add a flag for using WS for debug backend (#61359)

parent da8695d3
...@@ -42,6 +42,7 @@ typedef DwdsLauncher = Future<Dwds> Function({ ...@@ -42,6 +42,7 @@ typedef DwdsLauncher = Future<Dwds> Function({
bool enableDebugExtension, bool enableDebugExtension,
String hostname, String hostname,
bool useSseForDebugProxy, bool useSseForDebugProxy,
bool useSseForDebugBackend,
bool serveDevTools, bool serveDevTools,
void Function(Level, String) logWriter, void Function(Level, String) logWriter,
bool verbose, bool verbose,
...@@ -142,6 +143,7 @@ class WebAssetServer implements AssetReader { ...@@ -142,6 +143,7 @@ class WebAssetServer implements AssetReader {
int port, int port,
UrlTunneller urlTunneller, UrlTunneller urlTunneller,
bool useSseForDebugProxy, bool useSseForDebugProxy,
bool useSseForDebugBackend,
BuildInfo buildInfo, BuildInfo buildInfo,
bool enableDwds, bool enableDwds,
Uri entrypoint, Uri entrypoint,
...@@ -235,6 +237,7 @@ class WebAssetServer implements AssetReader { ...@@ -235,6 +237,7 @@ class WebAssetServer implements AssetReader {
urlEncoder: urlTunneller, urlEncoder: urlTunneller,
enableDebugging: true, enableDebugging: true,
useSseForDebugProxy: useSseForDebugProxy, useSseForDebugProxy: useSseForDebugProxy,
useSseForDebugBackend: useSseForDebugBackend,
serveDevTools: false, serveDevTools: false,
logWriter: (Level logLevel, String message) => globals.printTrace(message), logWriter: (Level logLevel, String message) => globals.printTrace(message),
loadStrategy: RequireStrategy( loadStrategy: RequireStrategy(
...@@ -627,6 +630,7 @@ class WebDevFS implements DevFS { ...@@ -627,6 +630,7 @@ class WebDevFS implements DevFS {
@required this.packagesFilePath, @required this.packagesFilePath,
@required this.urlTunneller, @required this.urlTunneller,
@required this.useSseForDebugProxy, @required this.useSseForDebugProxy,
@required this.useSseForDebugBackend,
@required this.buildInfo, @required this.buildInfo,
@required this.enableDwds, @required this.enableDwds,
@required this.entrypoint, @required this.entrypoint,
...@@ -641,6 +645,7 @@ class WebDevFS implements DevFS { ...@@ -641,6 +645,7 @@ class WebDevFS implements DevFS {
final String packagesFilePath; final String packagesFilePath;
final UrlTunneller urlTunneller; final UrlTunneller urlTunneller;
final bool useSseForDebugProxy; final bool useSseForDebugProxy;
final bool useSseForDebugBackend;
final BuildInfo buildInfo; final BuildInfo buildInfo;
final bool enableDwds; final bool enableDwds;
final bool testMode; final bool testMode;
...@@ -708,6 +713,7 @@ class WebDevFS implements DevFS { ...@@ -708,6 +713,7 @@ class WebDevFS implements DevFS {
port, port,
urlTunneller, urlTunneller,
useSseForDebugProxy, useSseForDebugProxy,
useSseForDebugBackend,
buildInfo, buildInfo,
enableDwds, enableDwds,
entrypoint, entrypoint,
......
...@@ -448,6 +448,7 @@ class _ResidentWebRunner extends ResidentWebRunner { ...@@ -448,6 +448,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
packagesFilePath: packagesFilePath, packagesFilePath: packagesFilePath,
urlTunneller: urlTunneller, urlTunneller: urlTunneller,
useSseForDebugProxy: debuggingOptions.webUseSseForDebugProxy, useSseForDebugProxy: debuggingOptions.webUseSseForDebugProxy,
useSseForDebugBackend: debuggingOptions.webUseSseForDebugBackend,
buildInfo: debuggingOptions.buildInfo, buildInfo: debuggingOptions.buildInfo,
enableDwds: _enableDwds, enableDwds: _enableDwds,
entrypoint: globals.fs.file(target).uri, entrypoint: globals.fs.file(target).uri,
......
...@@ -374,6 +374,7 @@ class RunCommand extends RunCommandBase { ...@@ -374,6 +374,7 @@ class RunCommand extends RunCommandBase {
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '', hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
port: featureFlags.isWebEnabled ? stringArg('web-port') : '', port: featureFlags.isWebEnabled ? stringArg('web-port') : '',
webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArg('web-server-debug-protocol') == 'sse', webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArg('web-server-debug-protocol') == 'sse',
webUseSseForDebugBackend: featureFlags.isWebEnabled && stringArg('web-server-debug-backend-protocol') == 'sse',
webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'), webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'),
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'), webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: browserDebugPort, webBrowserDebugPort: browserDebugPort,
...@@ -400,6 +401,7 @@ class RunCommand extends RunCommandBase { ...@@ -400,6 +401,7 @@ class RunCommand extends RunCommandBase {
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '', hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
port: featureFlags.isWebEnabled ? stringArg('web-port') : '', port: featureFlags.isWebEnabled ? stringArg('web-port') : '',
webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArg('web-server-debug-protocol') == 'sse', webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArg('web-server-debug-protocol') == 'sse',
webUseSseForDebugBackend: featureFlags.isWebEnabled && stringArg('web-server-debug-backend-protocol') == 'sse',
webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'), webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'),
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'), webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: browserDebugPort, webBrowserDebugPort: browserDebugPort,
......
...@@ -738,6 +738,7 @@ class DebuggingOptions { ...@@ -738,6 +738,7 @@ class DebuggingOptions {
this.port, this.port,
this.webEnableExposeUrl, this.webEnableExposeUrl,
this.webUseSseForDebugProxy = true, this.webUseSseForDebugProxy = true,
this.webUseSseForDebugBackend = true,
this.webRunHeadless = false, this.webRunHeadless = false,
this.webBrowserDebugPort, this.webBrowserDebugPort,
this.webEnableExpressionEvaluation = false, this.webEnableExpressionEvaluation = false,
...@@ -751,6 +752,7 @@ class DebuggingOptions { ...@@ -751,6 +752,7 @@ class DebuggingOptions {
this.hostname, this.hostname,
this.webEnableExposeUrl, this.webEnableExposeUrl,
this.webUseSseForDebugProxy = true, this.webUseSseForDebugProxy = true,
this.webUseSseForDebugBackend = true,
this.webRunHeadless = false, this.webRunHeadless = false,
this.webBrowserDebugPort, this.webBrowserDebugPort,
this.cacheSkSL = false, this.cacheSkSL = false,
...@@ -797,6 +799,7 @@ class DebuggingOptions { ...@@ -797,6 +799,7 @@ class DebuggingOptions {
final String hostname; final String hostname;
final bool webEnableExposeUrl; final bool webEnableExposeUrl;
final bool webUseSseForDebugProxy; final bool webUseSseForDebugProxy;
final bool webUseSseForDebugBackend;
/// Whether to run the browser in headless mode. /// Whether to run the browser in headless mode.
/// ///
......
...@@ -184,11 +184,20 @@ abstract class FlutterCommand extends Command<void> { ...@@ -184,11 +184,20 @@ abstract class FlutterCommand extends Command<void> {
allowed: <String>['sse', 'ws'], allowed: <String>['sse', 'ws'],
defaultsTo: 'sse', defaultsTo: 'sse',
help: 'The protocol (SSE or WebSockets) to use for the debug service proxy ' help: 'The protocol (SSE or WebSockets) to use for the debug service proxy '
'when using the Web Server device and Dart Debugger extension. ' 'when using the Web Server device and Dart Debug extension. '
'This is useful for editors/debug adapters that do not support debugging ' 'This is useful for editors/debug adapters that do not support debugging '
'over SSE (the default protocol for Web Server/Dart Debugger extension).', 'over SSE (the default protocol for Web Server/Dart Debugger extension).',
hide: hide, hide: hide,
); );
argParser.addOption('web-server-debug-backend-protocol',
allowed: <String>['sse', 'ws'],
defaultsTo: 'sse',
help: 'The protocol (SSE or WebSockets) to use for the Dart Debug Extension '
'backend service when using the Web Server device. '
'Using WebSockets can improve performance but may fail when connecting through '
'some proxy servers.',
hide: hide,
);
argParser.addFlag('web-allow-expose-url', argParser.addFlag('web-allow-expose-url',
defaultsTo: false, defaultsTo: false,
help: 'Enables daemon-to-editor requests (app.exposeUrl) for exposing URLs ' help: 'Enables daemon-to-editor requests (app.exposeUrl) for exposing URLs '
......
...@@ -461,6 +461,7 @@ void main() { ...@@ -461,6 +461,7 @@ void main() {
packagesFilePath: '.packages', packagesFilePath: '.packages',
urlTunneller: null, urlTunneller: null,
useSseForDebugProxy: true, useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: const BuildInfo( buildInfo: const BuildInfo(
BuildMode.debug, BuildMode.debug,
'', '',
...@@ -572,6 +573,7 @@ void main() { ...@@ -572,6 +573,7 @@ void main() {
packagesFilePath: '.packages', packagesFilePath: '.packages',
urlTunneller: null, urlTunneller: null,
useSseForDebugProxy: true, useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: const BuildInfo( buildInfo: const BuildInfo(
BuildMode.debug, BuildMode.debug,
'', '',
...@@ -680,6 +682,7 @@ void main() { ...@@ -680,6 +682,7 @@ void main() {
packagesFilePath: '.packages', packagesFilePath: '.packages',
urlTunneller: null, urlTunneller: null,
useSseForDebugProxy: true, useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: BuildInfo.debug, buildInfo: BuildInfo.debug,
enableDwds: false, enableDwds: false,
entrypoint: Uri.base, entrypoint: Uri.base,
...@@ -721,6 +724,7 @@ void main() { ...@@ -721,6 +724,7 @@ void main() {
packagesFilePath: '.packages', packagesFilePath: '.packages',
urlTunneller: null, urlTunneller: null,
useSseForDebugProxy: true, useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: const BuildInfo( buildInfo: const BuildInfo(
BuildMode.debug, BuildMode.debug,
'', '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment