Saved-to-server bookmarking error


#1

...
Hello.
I am able to make url bookmarking. But fail to use Saved-to-server bookmarking.

It show me a error message :Error bookmarking state: cannot open the connection

There are my 3 file: server.R ui.R global.R

#######     ui.R   #############
library(shiny)
library(shinydashboard)

shinyUI(fluidPage(  

  headerPanel("It's Alive by Tony!"),
  
  sidebarPanel(
    sliderInput("bins",
                  "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)
  ),
  
  mainPanel(
    plotOutput("distPlot", height=250)
    ,bookmarkButton()
  )
))

enableBookmarking("server")
##########  server.R #############
library(shiny)
library(shinydashboard)

shinyServer(function(input, output,session) {
  output$distPlot <- renderPlot({
    x    <- faithful[, 2]  # Old Faithful Geyser data
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    hist(x, breaks = bins, col = 'darkgray', border = 'white')
  })
 
})
############ global.R ############
library(shiny)
library(shinydashboard)
enableBookmarking("server")

#2

Hi @Tony_Duan,

I couldn't repeat the error, but I could enable server-side bookmarking by changing ui.R to the following

#######     ui.R   #############
library(shiny)
library(shinydashboard)

function(request) {
  shinyUI(fluidPage(

    headerPanel("It's Alive by Tony!"),

    sidebarPanel(
      sliderInput("bins",
                    "Number of bins:",
                    min = 1,
                    max = 50,
                    value = 30)
    ),

    mainPanel(
      plotOutput("distPlot", height=250)
      ,bookmarkButton()
    )
  ))
}