Package 'svHttp'

Title: 'SciViews' - HTTP Server
Description: A simple HTTP server allows to connect GUI clients to R.
Authors: Philippe Grosjean [aut, cre]
Maintainer: Philippe Grosjean <[email protected]>
License: GPL-2
Version: 1.0.4
Built: 2024-10-26 02:54:45 UTC
Source: https://github.com/SciViews/svHttp

Help Index


Get list of all names of clients that already connected to the http server

Description

Get list of all names of clients that already connected to the http server

Usage

http_server_clients()

HttpClientsNames()

Value

A character vector with the name of currently connected clients.

See Also

start_http_server() for a complete example.

Examples

library(svHttp)
http_server_clients()

Get or change the name of the HTTP server

Description

Get or change the name of the HTTP server

Usage

http_server_name(name)

HttpServerName(name)

Arguments

name

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

Value

A character vector with the name of the HTTP server.

See Also

start_http_server() for a complete example.

Examples

http_server_name()

Get or change the port of the HTTP server

Description

Get or change the port of the HTTP server

Usage

http_server_port(port)

HttpServerPort(port)

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).

Value

A number with the port of the HTTP server.

See Also

start_http_server() for a complete example.

Examples

http_server_port()

Get or change http server options

Description

Get or change http server options

Usage

par_http_server(client, ...)

parHttp(client, ...)

Arguments

client

the name of one client. A client that does not identify itself is named default.

...

named arguments specifying options to set or change.

Value

An environment that contains the whole configuration is returned invisibly.

Note

Possible named arguments (with their default values) are: prompt = ":> " for the server prompt, continue = ":+ " for the continuation prompt when multiline instructions are send, code = "" for current partial code in multiline mode, last = "" for a string to add at the end of each evaluation, echo = FALSE to echo commands at the R console or terminal, multiline = TRUE to allow multiline mode, bare = TRUE a bare mode that inactivates all other options (the server is always started in bare mode).

See Also

start_http_server() for a complete example.


(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)

Stop the SciViews and R HTTP server and eliminate all tracks

Description

Stop the SciViews and R HTTP server and eliminate all tracks

Usage

stop_http_server(remove.clients = FALSE)

stopHttpSever(remove.clients = FALSE)

Arguments

remove.clients

do we remove also persistent data for the clients, FALSE by default.

Value

A number with the port of the HTTP server.

See Also

start_http_server() for a complete example.