2015-11-21 2 views
1

У меня есть блестящее приложение, развернутое на сервере Linux. Я хочу, чтобы приложение тайм-аута, если в течение минуты нет активности. Основываясь на том, что я читал, я добавил строку app_idle_timeout в файл shiny-server.conf, но я заметил, что он не работает. Может кто-нибудь угодить советам, как я могу гарантировать, что сеанс истечет через минуту? Примечание. У меня нет блестящего сервера PRO.Блестящий сеанс сеанса сервера не работает

Ниже приведен пример моего shiny-server.conf.

Instruct Shiny Server to run applications as the user "shiny" 
run_as shiny; 

# Define a server that listens on port 3838 
server { 
    listen 3838; 

    # Define a location at the base URL 
    location/{ 

    # Host the directory of Shiny Apps stored in this directory 
    site_dir /srv/shiny-server; 

    # Log all Shiny output to files in this directory 
    log_dir /var/log/shiny-server; 
    app_idle_timeout 60; 

    # When a user visits the base URL rather than a particular application, 
    # an index of the applications available in this directory will be shown. 
    directory_index on; 

    } 
} 
~     

ответ

1

Функция таймаута сеанса недоступна на блестящем сервере с открытым исходным кодом. Он приходит только как часть про версии.

+0

Я добавил пример, чтобы обойти это –

2

Вы можете настроить свое idle время в приложении shiny, так как с помощью некоторых JS, приложение истечет через 5 секунд.

library(shiny) 
library(leaflet) 

inactivity <- "function idleTimer() { 
    var t = setTimeout(logout, 5000); 
    window.onmousemove = resetTimer; // catches mouse movements 
    window.onmousedown = resetTimer; // catches mouse movements 
    window.onclick = resetTimer;  // catches mouse clicks 
    window.onscroll = resetTimer; // catches scrolling 
    window.onkeypress = resetTimer; //catches keyboard actions 

    function logout() { 
    window.close(); //close the window 
    } 

    function resetTimer() { 
    clearTimeout(t); 
    t = setTimeout(logout, 5000); // time is in milliseconds (1000 is 1 second) 
    } 
} 
idleTimer();" 


ui <- fluidPage(
    tags$script(inactivity),  
    leafletOutput("mymap") 

) 

server <- shinyServer(function(input,output,session){ 

    points <- eventReactive(input$recalc, { 
    cbind(rnorm(40) * 2 + 13, rnorm(40) + 48) 
    }, ignoreNULL = FALSE) 

    output$mymap <- renderLeaflet({ 
    leaflet() %>% 
     addProviderTiles(providers$Stamen.TonerLite,options = providerTileOptions(noWrap = TRUE)) %>% 
     addMarkers(data = points()) 
    }) 

}) 
runApp(list(ui = ui, server = server)) 
Смежные вопросы