Fix port in shinny app

1,430 views
Skip to first unread message

Harshit Bhargava

unread,
Nov 25, 2016, 8:42:56 PM11/25/16
to Shiny - Web Framework for R
I want to fix my port.I have used options(shiny.port=portno) in ui.R but first time when i run the app it showing different port no.

Joe Cheng

unread,
Nov 25, 2016, 11:29:39 PM11/25/16
to Harshit Bhargava, Shiny - Web Framework for R
Yeah, by the time ui.R runs, it's too late. Why do you need the port fixed?

On Fri, Nov 25, 2016 at 5:42 PM Harshit Bhargava <h.bha...@gmail.com> wrote:
I want to fix my port.I have used options(shiny.port=portno) in ui.R but first time when i run the app it showing different port no.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/98a8080a-0924-4cff-9dac-ec3e7a94be4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harshit Bhargava

unread,
Nov 27, 2016, 11:22:04 AM11/27/16
to Shiny - Web Framework for R, h.bha...@gmail.com
Hi Joe, We are usng the shinny url in a part of web application.so there we need to pass the url. so we want the port to be fixed so that the url could be easily called rather than changing port numbers.

Joe Cheng

unread,
Nov 27, 2016, 11:53:17 AM11/27/16
to Harshit Bhargava, Shiny - Web Framework for R
Ideally you should be running Shiny Server. But if you're going to run Shiny standalone, then just provide the port number explicitly when calling runApp.

Harshit Bhargava

unread,
Nov 27, 2016, 7:17:28 PM11/27/16
to Shiny - Web Framework for R, h.bha...@gmail.com
Hi Joe, Is there any other way becuase my manager want the same to be run through the rtsudio runApp button.rather than explicitly calling the runApp explicitly through some command.

Joe Cheng

unread,
Nov 27, 2016, 7:21:33 PM11/27/16
to Harshit Bhargava, Shiny - Web Framework for R
Oh, fair enough. There's another solution that is possible which is to use the app.R single file style of Shiny app, and include the option on your shinyApp object. However this requires a newer version of Shiny than is currently on CRAN.

library(shiny)

ui <- fluidPage(...)

server <- function(input, output, session) {
...
}

shinyApp(ui, server, options = list(
port = 8100
))

Harshit Bhargava

unread,
Nov 27, 2016, 9:44:04 PM11/27/16
to Shiny - Web Framework for R, h.bha...@gmail.com
Hi Joe,Thanks for the quick response.

I have installed latest shiny version using the following command 
if (!require("devtools"))
install.packages("devtools")
devtools::install_github("rstudio/shiny")

then i have clubbed my ui.r and server.r into a single app.r file with the shinyApp(ui = ui, server = server, options = list(
  port = 4110
))

at last of my code

but still i am redirecting to other port than 4110


what could be the issue.

I am running shinnyapp through rstudio version -0.99.902

RAKOTOMANANA Mandalalaina Mahefa

unread,
Feb 1, 2019, 2:36:58 AM2/1/19
to Shiny - Web Framework for R
Harshit, i have the same problem,
Do you already found a solution?
Reply all
Reply to author
Forward
0 new messages