rstudio / shiny-server

Host Shiny applications over the web.
https://rstudio.com/shiny/server
Other
716 stars 289 forks source link

RobustSockJS collision repro #500

Open jcheng5 opened 3 years ago

jcheng5 commented 3 years ago

Running this app with DevTools showing, click the button within a few seconds of startup, and wait in the debugger for a few seconds. When you press Continue, you get the RobustSockJS collision error message.

When reproducing this, I had jsonp-polling as the only protocol enabled, not sure if that is relevant or not.

library(shiny)

ui <- fluidPage(
  tags$p(
    tags$strong("Instructions: "),
    "Press \"Cause error\". The correct behavior is for the counter to keep counting; the buggy behavior is for the counter to stop."
  ),
  textOutput("counter"),
  actionButton("go", "Cause error"),
  tags$script(HTML(r"{
    Shiny.addCustomMessageHandler('errorme', function(msg) {
      throw new Error('boom');
    });
  }"))
)

server <- function(input, output, session) {
  i <- 0
  output$counter <- renderText({
    invalidateLater(1000)
    i <<- i + 1
    i
  })

  observeEvent(input$go, {
    session$sendCustomMessage("errorme", list())
  })
}

shinyApp(ui, server)