Get a reactive that polls for new payload data
Usage
payload_last(path = "/ingress", session, intervalMillis = 300,
scope = c("global", "session"))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) {
# Global scope - data shared across all sessions
global_data <- payload_last("/data", session)
# Session scope - data isolated to this session only
session_data <- payload_last("/user-data", session, scope = "session")
observeEvent(global_data(), {
data <- global_data()
if (!is.null(data)) {
print(data$payload)
print(data$meta$timestamp)
}
})
}
}
