start_http_server: (Re)start an HTTP server in R

View source: R/start_http_server.R

start_http_serverR Documentation

(Re)start an HTTP server in R

Description

Turn the default R help HTTP server into a RJSONp SciViews server (while still serving help pages, of course).

Usage

start_http_server(port = http_server_port(), name = http_server_name())

startHttpServer(port = http_server_port(), name = http_server_name())

Arguments

port

port on which the server should run (both help and SciViews). By default, it is port 8888. Note that this server runs only locally and can only serve requests from 127.0.0.1 (because communication is not crypted).

name

the name given to the SciViews server. By default, it is R.

Value

An integer indicating the port used.

See Also

svSocket::start_socket_server()

Examples

## Not run: 
library(svHttp)
# Try to start the HTTP server on default port with default name
res <- try(start_http_server(), silent = TRUE)
if (!inherits(res, "try-error")) {
  # Get the port
  http_server_port()

  # Get the name
  http_server_name()

  # Get the list of clients... empty, unless you connect a client in between
  http_server_clients()

}
# Stop the server now
 stop_http_server()

## End(Not run)

SciViews/svHttp documentation built on May 12, 2022, 2:48 a.m.