I have an application running on shinyapps.io (https://vnijs.shinyapps.io/radiant-data). Works great. It also works as expected from Rstudio on macOS, Windows, Linux, and Rstudio Cloud. However, when I run it on a linux (Ubuntu 18.04) server with shiny-server (1.5.9.923) or shiny-server pro (1.5.11.994) one specific feature does not work.
If you go to the app url shown above and too, for example, the View tab and select a single variable, the variable and tab selection should be correctly shown again after a browser refresh (i.e., app state is maintained). See screenshot below for an illustration. Again, this feature works as expected everywhere except shiny-server and shiny-server pro. Note: There are no browser or server errors shown that could provide a clue as to why this one feature does not work.
My question: Could someone perhaps provide more information on the exact setup (OS) and configuration (shiny-server.conf) used for the shinyapps.io server?
EDIT: I just noticed that when running from shiny server the app does still state a state-file with current settings that it is supposed to loaded back in during the refresh. However, for some reason this takes about 20sec with shiny-server and by that time the browser has already completed its refresh and ignores the file. Again, with the same data and settings this works great when run from Rstudio or on shinypapps.io. From Rstudio it even works with big-ish datasets of > 700MB
Sorry for the delay, Vincent. I looked at this Friday and today and, while I can repro it with your docker image, I can't really figure out what's happening--obviously Radiant is a very large codebase and this state bookmarking mechanism is totally custom (and very impressive, I might add).
To answer your direct question, the last I checked, shinyapps.io is run on a customized version of RStudio Connect. I have no idea why Connect would act any different than Shiny Server though; from the browser's perspective they should be acting the same.
Thanks for the response Joe. For some reason, after a browser refresh, onSessionEnded doesn't kick in until after the new session has already started to initialize when using shiny-server. When launching from Rstudio, and I assume also on Rstudio Connect, however onSessionedEnded completes before the new session is started.
I'm pretty sure this used to work with previous versions of shiny-server actually but there only seem to be a few binaries available on your server (https://download3.rstudio.org/ubuntu-14.04/x86_64). Are the binaries still available somewhere so I could try this out? I did try building older versions of shiny-server from source as part of the docker build process but kept running into errors.
Basically, from the server's perspective we don't know if you left because you reloaded or because the tab closed, or if there is a transient networking error and you'll be back. Just in case it's the latter, we wait for 15 seconds to actually end the session.
Try adding reconnect false; to your /etc/shiny-server/shiny-server.conf file to disable this behavior.
Excellent! Thanks Joe, that was the sticking point. I assume then that reconnect false is the default for Rstudio Connect but not for shiny-server.
Is there an easy way to check, inside a shiny-app, if reconnect is set to true or false? That way I could add a modal/message popup suggesting this change to the shiny-server.conf file.