Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log output 2018-10-15T10:52:36.905038+00:00 heroku[router]: at=error code=H15 desc="Idle connection" method=GET path="/websocket/" host=myapp.herokuapp.com request_id=62ff6c68-a766-46a2-9a44-f3f4f6aebab0 fwd="165.225.81.40" dyno=web.1 connect=1ms service=77186ms status=503 bytes= protocol=https
2018-10-15T10:52:36.905038+00:00 heroku[router]: at=error code=H15 desc="Idle connection" method=GET path="/websocket/" host=myapp.herokuapp.com request_id=62ff6c68-a766-46a2-9a44-f3f4f6aebab0 fwd="165.225.81.40" dyno=web.1 connect=1ms service=77186ms status=503 bytes= protocol=https
I want to use my heroku app as a dashboard so I would have extended periods of inactivity. How is that possible without my application shutting down due to an idle connection?
The text was updated successfully, but these errors were encountered:
Hi @christakopoulosa
This is a known issue on Heroku, since websocket connections are disconnected after a period of inactivity. See the Heroku documentation on HTTP Routing - Timeouts and Long-polling and streaming responses for more information.
The simplest way to solve it, is to have a "keep alive" mechanism, as the following example shows, taken from shiny issues #2110.
Here's a simple solution to increment a counter every 10 seconds. JS var socket_timeout_interval; var n = 0; $(document).on('shiny:connected', function(event) { socket_timeout_interval = setInterval(function() { Shiny.onInputChange('alive_count', n++) }, 10000); }); $(document).on('shiny:disconnected', function(event) { clearInterval(socket_timeout_interval) }); CSS #keep_alive { visibility: hidden; } server.R output$keep_alive <- renderText({ req(input$alive_count) input$alive_count }) ui.R textOutput("keep_alive")
Here's a simple solution to increment a counter every 10 seconds.
JS
var socket_timeout_interval; var n = 0; $(document).on('shiny:connected', function(event) { socket_timeout_interval = setInterval(function() { Shiny.onInputChange('alive_count', n++) }, 10000); }); $(document).on('shiny:disconnected', function(event) { clearInterval(socket_timeout_interval) });
CSS
#keep_alive { visibility: hidden; }
server.R
output$keep_alive <- renderText({ req(input$alive_count) input$alive_count })
ui.R
textOutput("keep_alive")
Furthermore, the Shiny documentation has a article on Reconnecting to Shiny apps which may help, although I haven't tried this.
See also issue #97.
Sorry, something went wrong.
No branches or pull requests
Log output
2018-10-15T10:52:36.905038+00:00 heroku[router]: at=error code=H15 desc="Idle connection" method=GET path="/websocket/" host=myapp.herokuapp.com request_id=62ff6c68-a766-46a2-9a44-f3f4f6aebab0 fwd="165.225.81.40" dyno=web.1 connect=1ms service=77186ms status=503 bytes= protocol=httpsI want to use my heroku app as a dashboard so I would have extended periods of inactivity. How is that possible without my application shutting down due to an idle connection?
The text was updated successfully, but these errors were encountered: