Create an HTTP/WebSocket daemonized server (experimental)
Creates an HTTP/WebSocket server on the specified host and port. The server is daemonized so R interactive sessions are not blocked to handle requests.
startDaemonizedServer(host, port, app)
A string that is a valid IPv4 address that is owned by this
A number or integer that indicates the server port that should be listened on. Note that on most Unix-like systems including Linux and Mac OS X, port numbers smaller than 1025 require root privileges.
A collection of functions that define your application. See Details.
In contrast to servers created by
startServer, calls to
are not needed to accept and handle connections. If the port
cannot be bound (most likely due to permissions or because it is already
bound), an error is raised.
app parameter is where your application logic will be provided
to the server. This can be a list, environment, or reference class that
contains the following named functions/methods:
Process the given HTTP request, and return an HTTP response. This method should be implemented in accordance with the Rook specification.
Optional. Similar to
call, but occurs when headers are received. Return
NULLto continue normal processing of the request, or a Rook response to send that response, stop processing the request, and ask the client to close the connection. (This can be used to implement upload size limits, for example.)
Called back when a WebSocket connection is established. The given object can be used to be notified when a message is received from the client, to send messages to the client, etc. See
startPipeServer variant is not supported yet.
A handle for this server that can be passed to
stopDaemonizedServer to shut the server down.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.