-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android-livereload-localhost): #1776
Conversation
* Use request proxy handler when livereload and appUrl localhost:8100 * Reconnect when connection has not been established
37c05f6
to
a32fa60
Compare
Thanks, but this only works on simulators, on real devices it will try to proxy localhost:8100, and that will fail because "localhost" will be the device, but the server is in the computer. I think Ionic CLI will be updated to use |
yes, the objective is also to let the user add the port fordwarding in the chrome inspector |
When I run livereload using |
Ah, didn't think about port forwarding. |
@@ -173,10 +173,11 @@ public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) { | |||
return null; | |||
} | |||
|
|||
if (isLocalFile(loadingUrl) || loadingUrl.toString().startsWith(bridge.getLocalUrl())) { | |||
if (isLocalFile(loadingUrl) || !bridge.getAppUrl().contains("localhost:8100") && loadingUrl.toString().startsWith(bridge.getLocalUrl())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a good check, will stop working if the user changes the default port. It's probably better to just check Config.getString("server.url") == null
|
||
HttpURLConnection conn; | ||
boolean isContentTypeNull; | ||
do { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really confortable putting a while with Thread.sleep, might be useful for reconnection, but could cause problems if the networks is down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is a better way you could point me, I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I could throw an error after 10 attempts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested the reconnection doesn't seem to work, so just remove that code for now and make the other requested change
This will allow users run:
and let connect the app to
localhost:8100
without the need to use--address=0.0.0.0