Thank you very much for your reply.
I was able to get the port number printed out to a file if I'm running the app in rstudio. However, I wasn't if I ran it through the command line.
Apologized for not being precise before, but I actually run the app in the command line like this:
R -e "shiny::runApp()"
and in the server function, I generated the file with port number:
server <- function(input, output, session) {
write.table(isolate(session$clientData$url_port),file=“port.txt”)
}
and in this way, there is no file generated.
With the port number, I am trying to automatically open firefox with the correct port number.