Unverified Commit 563338a1 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

Support WebSockets for injected client (#78961)

parent aa1df71c
......@@ -177,6 +177,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
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',
webUseSseForInjectedClient: featureFlags.isWebEnabled && stringArg('web-server-debug-injected-client-protocol') == 'sse',
webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'),
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: browserDebugPort,
......@@ -209,6 +210,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
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',
webUseSseForInjectedClient: featureFlags.isWebEnabled && stringArg('web-server-debug-injected-client-protocol') == 'sse',
webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'),
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: browserDebugPort,
......
......@@ -862,6 +862,7 @@ class DebuggingOptions {
this.webEnableExposeUrl,
this.webUseSseForDebugProxy = true,
this.webUseSseForDebugBackend = true,
this.webUseSseForInjectedClient = true,
this.webRunHeadless = false,
this.webBrowserDebugPort,
this.webEnableExpressionEvaluation = false,
......@@ -878,6 +879,7 @@ class DebuggingOptions {
this.webEnableExposeUrl,
this.webUseSseForDebugProxy = true,
this.webUseSseForDebugBackend = true,
this.webUseSseForInjectedClient = true,
this.webRunHeadless = false,
this.webBrowserDebugPort,
this.cacheSkSL = false,
......@@ -936,6 +938,7 @@ class DebuggingOptions {
final bool webEnableExposeUrl;
final bool webUseSseForDebugProxy;
final bool webUseSseForDebugBackend;
final bool webUseSseForInjectedClient;
/// Whether to run the browser in headless mode.
///
......
......@@ -51,6 +51,7 @@ typedef DwdsLauncher = Future<Dwds> Function(
String hostname,
bool useSseForDebugProxy,
bool useSseForDebugBackend,
bool useSseForInjectedClient,
bool serveDevTools,
UrlEncoder urlEncoder,
bool spawnDds});
......@@ -172,6 +173,7 @@ class WebAssetServer implements AssetReader {
UrlTunneller urlTunneller,
bool useSseForDebugProxy,
bool useSseForDebugBackend,
bool useSseForInjectedClient,
BuildInfo buildInfo,
bool enableDwds,
bool enableDds,
......@@ -274,6 +276,7 @@ class WebAssetServer implements AssetReader {
enableDebugging: true,
useSseForDebugProxy: useSseForDebugProxy,
useSseForDebugBackend: useSseForDebugBackend,
useSseForInjectedClient: useSseForInjectedClient,
serveDevTools: false,
loadStrategy: FrontendServerRequireStrategyProvider(
ReloadConfiguration.none,
......@@ -608,6 +611,7 @@ class WebDevFS implements DevFS {
@required this.urlTunneller,
@required this.useSseForDebugProxy,
@required this.useSseForDebugBackend,
@required this.useSseForInjectedClient,
@required this.buildInfo,
@required this.enableDwds,
@required this.enableDds,
......@@ -626,6 +630,7 @@ class WebDevFS implements DevFS {
final UrlTunneller urlTunneller;
final bool useSseForDebugProxy;
final bool useSseForDebugBackend;
final bool useSseForInjectedClient;
final BuildInfo buildInfo;
final bool enableDwds;
final bool enableDds;
......@@ -704,6 +709,7 @@ class WebDevFS implements DevFS {
urlTunneller,
useSseForDebugProxy,
useSseForDebugBackend,
useSseForInjectedClient,
buildInfo,
enableDwds,
enableDds,
......
......@@ -502,6 +502,7 @@ class ResidentWebRunner extends ResidentRunner {
urlTunneller: _urlTunneller,
useSseForDebugProxy: debuggingOptions.webUseSseForDebugProxy,
useSseForDebugBackend: debuggingOptions.webUseSseForDebugBackend,
useSseForInjectedClient: debuggingOptions.webUseSseForInjectedClient,
buildInfo: debuggingOptions.buildInfo,
enableDwds: _enableDwds,
enableDds: !debuggingOptions.disableDds,
......
......@@ -228,6 +228,15 @@ abstract class FlutterCommand extends Command<void> {
'some proxy servers.',
hide: !verboseHelp,
);
argParser.addOption('web-server-debug-injected-client-protocol',
allowed: <String>['sse', 'ws'],
defaultsTo: 'sse',
help: 'The protocol (SSE or WebSockets) to use for the injected client '
'when using the Web Server device. '
'Using WebSockets can improve performance but may fail when connecting through '
'some proxy servers.',
hide: !verboseHelp,
);
argParser.addFlag('web-allow-expose-url',
defaultsTo: false,
help: 'Enables daemon-to-editor requests (app.exposeUrl) for exposing URLs '
......
......@@ -616,6 +616,7 @@ void main() {
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
useSseForInjectedClient: true,
nullAssertions: true,
nativeNullAssertions: true,
buildInfo: const BuildInfo(
......@@ -733,6 +734,7 @@ void main() {
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
useSseForInjectedClient: true,
nullAssertions: true,
nativeNullAssertions: true,
buildInfo: const BuildInfo(
......@@ -847,6 +849,7 @@ void main() {
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
useSseForInjectedClient: true,
buildInfo: BuildInfo.debug,
enableDwds: false,
enableDds: false,
......@@ -891,6 +894,7 @@ void main() {
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
useSseForInjectedClient: true,
nullAssertions: true,
nativeNullAssertions: true,
buildInfo: const BuildInfo(
......@@ -943,6 +947,7 @@ void main() {
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
useSseForInjectedClient: true,
nullAssertions: true,
nativeNullAssertions: true,
buildInfo: const BuildInfo(
......@@ -979,6 +984,7 @@ void main() {
null,
true,
true,
true,
const BuildInfo(
BuildMode.debug,
'',
......@@ -1061,6 +1067,7 @@ void main() {
urlTunneller: null,
useSseForDebugProxy: true,
useSseForDebugBackend: true,
useSseForInjectedClient: true,
nullAssertions: true,
nativeNullAssertions: true,
buildInfo: BuildInfo.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