Is it possible to make a static webpage with shiny?

I made a shiny app that severs to collect data from the user and send it to a database.

When the users access it on a mobile phone it gets annoying disconnections if the user leaves the browser, but other reactive technologies and web apps don't disconnect like that.

Is there a way to make shiny app behave as a Static webpage? I mean, that never disconnects from the server?

Why someone would like to do that, as the interactivity is the shiny's core?
Because it has incredibly easy tools for building customizable forms connected to a database and easy hosting from shiny.io.

I thought a solution would be a hybrid: static webpage: javascript and css for form validation and when the user hits the button triggers the reactivity to send the data then it connects to the server and runs R script needed.

In general, Shiny web sessions end when the user enters a different URL in the browser's window for the Shiny app or closes the app's window. It's not clear what you mean by "leaves the browser," but if it's one of those two things the session will end. On the other hand, clicking on a different browser tab, for example, will not end the session, nor will switching from the browser app to some other app on the phone. If either of those things are ending the session, there's a fixable problem in your shiny code. - Tom

Hi Tom,

When I say "user leaves the browser" it means that he's switching between apps on the phone. It does have the effect of disconnecting from shiny app in iPhones. Also if he's using the shiny app and receives a call.
Web apps built with Angular there's no such disconnected effect.

Here's a little code that might help you.

cat(paste0("Session started @ ", now(), ".\n"))
onSessionEnded(function() {
   cat(paste0("Session ended @ ", now(), ".\n\n"))
})

Add this near the top of your shiny server function. It will add lines to the shiny server log when a session starts and ends and shed a tiny bit of light on what the server thinks is going on.

now() is a function in the lubridate package. If you're not loading that you can substitute R's Sys.time(), I think.

You don't have a stopApp() function anywhere in your code, do you?

Tom

PS - Are you running your app out of a Shiny Server app directory or site directory? My own experience is mostly with the app directory, so that might make a difference.

If you don't recognize what I'm talking about, it has to do with Shiny Server configuration - there's more information about how my own server is set up here.

I don't think you got the problem, Tom. I understand already its behavior but I'm trying to find a turnaround...

I might get something better with https://shiny.rstudio.com/articles/reconnecting.html and using

session$allowReconnect(TRUE)

But the app still drops, at least it reconnects with inputs filled...