Learn R Programming

sofa (version 0.2.0)

db_updates: Get information on database updates

Description

Get information on database updates

Usage

db_updates(cushion, feed = "longpoll", timeout = 60, heartbeat = TRUE, as = "list", ...)

Arguments

cushion
A Cushion object. Required.
feed
(character) One of longpoll (default), continuous, or eventsource. See Details.
timeout
(integer) Number of seconds until CouchDB closes the connection. Default: 60.
heartbeat
(logical) Whether CouchDB will send a newline character on timeout. Default: TRUE
as
(character) One of list (default) or json
...
Curl args passed on to one of the HTTP verbs (e.g,. GET, POST, PUT, etc.)

Value

JSON as a character string or a list (determined by the as parameter)

Details

This may not be very appropriate for use in R, but who knows, so here it is.

Also, continuous and eventsource don't seem to work in R, unless I'm missing something.

Options for the feed parmeter:

  • longpoll: Closes the connection after the first event.
  • continuous: Send a line of JSON per event. Keeps the socket open until timeout.
  • eventsource: Like, continuous, but sends the events in EventSource format.

Examples

Run this code
## Not run: 
# (x <- Cushion$new())
# 
# db_updates(x)
# db_updates(x, feed="continuous")
# db_updates(x, feed="eventsource")
# ## End(Not run)

Run the code above in your browser using DataLab