inst/examples/example_db.R

library(shinyChatR)

# store db as tempfile. Select different path to store db locally
tempdb <- file.path(tempdir(), "db")

con <- dbConnect(RSQLite::SQLite(), tempdb)


ui <- fluidPage(

  fluidRow(
    column(width = 6,
           # add chat ui elements
           chat_ui("test1"),
    )
  )
)


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

  # corresponding server part for id test1
  chat_server("test1", db_connection = con,
              db_table_name = "chat_data",
              chat_user = "user1"
              )
}


# Run the application
shinyApp(ui = ui, server = server)

Try the shinyChatR package in your browser

Any scripts or data that you put into this service are public.

shinyChatR documentation built on May 29, 2024, 8:18 a.m.