shinyMobile icon indicating copy to clipboard operation
shinyMobile copied to clipboard

refuse to connect in the example code for preview_mobile

Open zhiiiyang opened this issue 4 years ago • 5 comments

Hi, I am trying to reproduce the example as follow

preview_mobile(appPath = system.file("examples/gallery/app.R", package = "shinyMobile"), 
device = "iphoneX")

However, the phone screen does pop up in the browser but it said that "127.0.0.1 refused to connect.". Not sure if I set up things correctly. Thank you!

FYI, the url in the web browser is http://127.0.0.1:1919/

Screen Shot 2020-05-24 at 12 59 20 AM

zhiiiyang avatar May 24 '20 08:05 zhiiiyang

are you behind a proxy?

DivadNojnarg avatar Jun 08 '20 22:06 DivadNojnarg

Not really.

zhiiiyang avatar Jun 09 '20 04:06 zhiiiyang

What OS are you using? Alternatively, you could try to run the app in a new process:

p <- processx::process$new(
    "Rscript", 
    c(
        "-e", 
        "options('shiny.port'= 2811); shinyMobile::f7Gallery()"
    )
)
# TRUE if the app is running
p$is_alive()

and then call preview_mobile pointing to the port previously fixed (2811):

shinyMobile::preview_mobile(url = "http://127.0.0.1:2811", device = "iphoneX")

The url could also be http://localhost:2811

DivadNojnarg avatar Jun 09 '20 06:06 DivadNojnarg

Thanks. I am using the macOS 10.15.5. I tried the command which still doesn't show any preview.

Screen Shot 2020-06-09 at 10 28 53 AM Screen Shot 2020-06-09 at 10 30 48 AM

zhiiiyang avatar Jun 09 '20 17:06 zhiiiyang

I'm having the same problem! I don't understand how the package documentation doesn't contain instructions on how to run the application as if you were using a mobile phone. Obviously I'm not interested in seeing the app as if it were on a desktop. When I run the command

preview_mobile(appPath = system.file("app.R", package = "shinyMobile"), device = "iphoneX")

the message appears in the console:

Copy in your terminal (not the R console):R -e "shiny::runApp('',port=3838)"

This is wrong!!!!! At the very least, the current directory of the "app.R" file should appear.

ivanalaman avatar Sep 29 '23 11:09 ivanalaman