From 25be2a8e28a2d83a56ff74f27fda8b682b250890 Mon Sep 17 00:00:00 2001 From: Patrick Galbraith <811945+patrickgalbraith@users.noreply.github.com> Date: Thu, 24 Jun 2021 04:23:00 -0700 Subject: [PATCH] Update inspectorProxy with IPV6 localhost address (#662) Summary: **Summary** For IPV4 the webSocketDebuggerUrl defaults to `ws://localhost:8081` but for IPV6 this defaults to `ws://[::]:8081`. This causes issues since `ws://[::]` is not a valid websocket URL, I am guessing it should be `ws:[::1]` which is the IPV6 equivalent. **Test plan** The webSocketDebuggerUrl should be `ws:[::1]` rather than `ws://[::]`. This is related to this issue in Flipper https://github.com/facebook/flipper/issues/1520. Pull Request resolved: https://github.com/facebook/metro/pull/662 Reviewed By: GijsWeterings Differential Revision: D29210395 Pulled By: motiz88 fbshipit-source-id: 1522265f786765156aa650c704ad5d2c0605ca24 --- packages/metro-inspector-proxy/src/InspectorProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/metro-inspector-proxy/src/InspectorProxy.js b/packages/metro-inspector-proxy/src/InspectorProxy.js index be7c83fa6f..ecdde04108 100644 --- a/packages/metro-inspector-proxy/src/InspectorProxy.js +++ b/packages/metro-inspector-proxy/src/InspectorProxy.js @@ -98,7 +98,7 @@ class InspectorProxy { addWebSocketListener(server: HttpServer | HttpsServer) { const {port} = server.address(); if (server.address().family === 'IPv6') { - this._serverAddressWithPort = `[::]:${port}`; + this._serverAddressWithPort = `[::1]:${port}`; } else { this._serverAddressWithPort = `localhost:${port}`; }