When running any shiny app in RStudio Server, if I run the app in the viewer pane
and then click "Show in new window", I get a new browser tab whose URL is forwarded by RStudio Server to the host and port of the running shiny app. For example, if I run
> shiny::runApp('test')
Listening on http://127.0.0.1:7515
Unfortunately, the mapping is a function of a browser cookie that RStudio Server sets and I doubt it is possible to retrieve this value from the R session running on the server.
I'll admit it is an odd reason... I only used shiny::runApp as an example because it is familiar. In actuality, I want to be lazy and leverage RStudio's port mapping to access another web service in another browser tab without opening more ports on the host machine. The other web service being glances in this particular case (I'm looking to monitor resource consumption).
I was thinking of printing the port-mapped link from some code in Rprofile.site, so it would only be known to authenticated RStudio Server sessions.
I ended up using the rstudioapi package to open the service in the Viewer. I can then pop it out into another tab manually.