为什么 Shiny 应用程序在一段时间不使用时会断开连接?

Why does a Shiny app get disconnected when not used for a while?

我在 Ubuntu 16.04 服务器上安装的 Shiny 服务器中有一个 Shiny 应用 运行ning。

当应用程序在浏览器中加载但 运行 一段时间后,它会断开连接。

是否有防止这种情况发生的解决方案?

您可以尝试将重复信号放入您的服务器功能中,使我的应用程序保持活动状态:

#Keep App alive
keep_alive <- shiny::reactiveTimer(intervalMs = 10000, 
                                        session = shiny::getDefaultReactiveDomain())

shiny::observe({keep_alive()})
  

您实际上可以通过在 Shiny 服务器配置文件中将其设置为 0 来永久禁用 app_idle_timeout

location / {
    app_idle_timeout 0;
}