Closed renkun-ken closed 4 years ago
This is very likely caused by remote (localhost) and local (localhost) port forwarding conflict in WebView in VSCode Remote Development. Let me take a closer look at this.
When I start the http server with the real intranet IP of the server, and open a webview of that IP in the URL, then the web view works.
The port forwarding has no problem. I tried with
httpgd::httpgd(host = "127.0.0.1")
and everthing works fine.
I guess we should use 127.0.0.1
as the default host instead of localhost
as shiny, R help http server both uses 127.0.0.1
host by default.
I'm testing on a Ubuntu 18.04 Server in local network.
When I open the URL
http://localserver:24680
, it showshttpgd server running.
which looks normal. But inhttp://localserver:24680/live
, the page is blank and then showsDisconnected
on the top-right corner:Then I run the following code in R:
and the webpage in browser shows the graphics in a couple of seconds.
If I open the page in a webview in VSCode,
The graphics is never shown.
I'm not sure if there's something missing but httpgd works nicely via VSCode Remote Development as I tested from my macOS connecting via sshuttle to my work place desktop server.