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({
bool enableDebugExtension,
String hostname,
bool useSseForDebugProxy,
bool useSseForDebugBackend,
bool serveDevTools,
void Function(Level, String) logWriter,
bool verbose,
......@@ -142,6 +143,7 @@ class WebAssetServer implements AssetReader {
int port,
UrlTunneller urlTunneller,
bool useSseForDebugProxy,
bool useSseForDebugBackend,
BuildInfo buildInfo,
bool enableDwds,
Uri entrypoint,
......@@ -235,6 +237,7 @@ class WebAssetServer implements AssetReader {
urlEncoder: urlTunneller,
enableDebugging: true,
useSseForDebugProxy: useSseForDebugProxy,
useSseForDebugBackend: useSseForDebugBackend,
serveDevTools: false,
logWriter: (Level logLevel, String message) => globals.printTrace(message),
loadStrategy: RequireStrategy(
......@@ -627,6 +630,7 @@ class WebDevFS implements DevFS {
@required this.packagesFilePath,
@required this.urlTunneller,
@required this.useSseForDebugProxy,
@required this.useSseForDebugBackend,
@required this.buildInfo,
@required this.enableDwds,
@required this.entrypoint,
......@@ -641,6 +645,7 @@ class WebDevFS implements DevFS {
final String packagesFilePath;
final UrlTunneller urlTunneller;
final bool useSseForDebugProxy;
final bool useSseForDebugBackend;
final BuildInfo buildInfo;
final bool enableDwds;
final bool testMode;
......@@ -708,6 +713,7 @@ class WebDevFS implements DevFS {
port,
urlTunneller,
useSseForDebugProxy,
useSseForDebugBackend,
buildInfo,
enableDwds,
entrypoint,
......
......@@ -448,6 +448,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
packagesFilePath: packagesFilePath,
urlTunneller: urlTunneller,
useSseForDebugProxy: debuggingOptions.webUseSseForDebugProxy,
useSseForDebugBackend: debuggingOptions.webUseSseForDebugBackend,
buildInfo: debuggingOptions.buildInfo,
enableDwds: _enableDwds,
entrypoint: globals.fs.file(target).uri,
......
......@@ -374,6 +374,7 @@ class RunCommand extends RunCommandBase {
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
port: featureFlags.isWebEnabled ? stringArg('web-port') : '',
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'),
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: browserDebugPort,
......@@ -400,6 +401,7 @@ class RunCommand extends RunCommandBase {
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
port: featureFlags.isWebEnabled ? stringArg('web-port') : '',
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'),
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: browserDebugPort,
......
......@@ -738,6 +738,7 @@ class DebuggingOptions {
this.port,
this.webEnableExposeUrl,
this.webUseSseForDebugProxy = true,
this.webUseSseForDebugBackend = true,
this.webRunHeadless = false,
this.webBrowserDebugPort,
this.webEnableExpressionEvaluation = false,
......@@ -751,6 +752,7 @@ class DebuggingOptions {
this.hostname,
this.webEnableExposeUrl,
this.webUseSseForDebugProxy = true,
this.webUseSseForDebugBackend = true,
this.webRunHeadless = false,
this.webBrowserDebugPort,
this.cacheSkSL = false,
......@@ -797,6 +799,7 @@ class DebuggingOptions {
final String hostname;
final bool webEnableExposeUrl;
final bool webUseSseForDebugProxy;
final bool webUseSseForDebugBackend;
/// Whether to run the browser in headless mode.
///
......
......@@ -184,11 +184,20 @@ abstract class FlutterCommand extends Command<void> {
allowed: <String>['sse', 'ws'],
defaultsTo: 'sse',
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 '
'over SSE (the default protocol for Web Server/Dart Debugger extension).',
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',
defaultsTo: false,
help: 'Enables daemon-to-editor requests (app.exposeUrl) for exposing URLs '
......
......@@ -461,6 +461,7 @@ void main() {
packagesFilePath: '.packages',
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: const BuildInfo(
BuildMode.debug,
'',
......@@ -572,6 +573,7 @@ void main() {
packagesFilePath: '.packages',
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: const BuildInfo(
BuildMode.debug,
'',
......@@ -680,6 +682,7 @@ void main() {
packagesFilePath: '.packages',
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: BuildInfo.debug,
enableDwds: false,
entrypoint: Uri.base,
......@@ -721,6 +724,7 @@ void main() {
packagesFilePath: '.packages',
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
buildInfo: const BuildInfo(
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