Skip to contents

Creates the server logic for the chat module, which handles adding new messages to the database or RDS file, and retrieving messages to display

Usage

chat_server(
  id,
  chat_user,
  db_connection = NULL,
  db_table_name = "chat_data",
  rds_path = NULL,
  csv_path = NULL,
  invalidateDSMillis = 1000,
  pretty = TRUE,
  nlast = 100
)

Arguments

id

The id of the module.

chat_user

The user name that should be displayed next to the message.

db_connection

A database connection object, created using the DBI package. If provided, the chat messages will be stored in a database table.

db_table_name

he name of the database table to use for storing the chat messages. If db_connection is provided, this parameter is required.

rds_path

The path to an RDS file to use for storing the chat messages. If provided, the chat messages will be stored in an RDS file.

csv_path

The path to an csv file to use for storing the chat messages. If provided, the chat messages will be stored in an csv file.

invalidateDSMillis

The milliseconds to wait before the data source is read again. The default is 1 second.

pretty

Logical that determines if the date should be displayed in a pretty format

nlast

The number of last messages to be read in and displayed

Value

the reactive values chat_rv with all the chat information