service {httpuv} | R Documentation |
Process HTTP requests and WebSocket messages. Even if a server exists, no
requests are serviced unless and until service
is called.
service(timeoutMs = ifelse(interactive(), 100, 1000))
timeoutMs |
Approximate number of milliseconds to run before returning. If 0, then the function will continually process requests without returning unless an error occurs. If NA, performs a non-blocking run without waiting. |
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.
## Not run: while (TRUE) { service() Sys.sleep(0.001) } ## End(Not run)