Skip to contents

Get a reactive that polls for new payload data

Usage

payload_last(path = "/ingress", session, intervalMillis = 300)

Arguments

path

The URL path used in payload_ui() (default "/ingress")

session

The Shiny session object

intervalMillis

Polling interval in milliseconds (default 300)

Value

A reactive expression (class "reactive") that returns a list with two elements when new data is available: payload (the parsed request body) and meta (metadata including timestamp, remote address, headers, etc.), or NULL if no data has been received yet.

Examples

if (interactive()) {
server <- function(input, output, session) {
  latest_data <- payload_last("/data", session)

  observeEvent(latest_data(), {
    data <- latest_data()
    if (!is.null(data)) {
      print(data$payload)
      print(data$meta$timestamp)
    }
  })
}
}