service: Process requests

Description Usage Arguments Details Examples

View source: R/httpuv.R

Description

Process HTTP requests and WebSocket messages. Even if a server exists, no requests are serviced unless and until service is called.

Usage

1
service(timeoutMs = ifelse(interactive(), 100, 1000))

Arguments

timeoutMs

Approximate number of milliseconds to run before returning. If 0, then the function will continually process requests without returning unless an error occurs.

Details

Note that while service is waiting for a new request, the process is not interruptible using normal R means (Esc, Ctrl+C, etc.). If being interruptible is a requirement, then call service in a while loop with a very short but non-zero Sys.sleep during each iteration.

Examples

1
2
3
4
5
6
7
## Not run: 
while (TRUE) {
  service()
  Sys.sleep(0.001)
}

## End(Not run)

httpuv documentation built on May 20, 2017, 4:34 a.m.

Search within the httpuv package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.