R: Functions usable for R code run inside Rserve

self {Rserve} | R Documentation

## Functions usable for R code run inside Rserve

### Description

The following functions can only be used inside Rserve, they cannot be used in stand-alone R. They interact with special features of Rserve. All commands below will succeed only if Rserve has been started with `r-control enable` configuration setting for security reasons.

`self.ctrlEval` issues a control command to the Rserve parent instance that evaluates the given expression in the server. The expression is only queued for evaluation which will happen asynchronously in the server (see `RSserverEval` in `RSclient` package for details). Note that the current session is unaffected by the command.

`self.ctrlSource` issues a control command to the Rserve parent instance to source the given file in the server, see `RSserverSource` in the `RSclient` package for details.

`self.oobSend` sends a out-of-band (OOB) message with the encoded content of `what` to the client connected to this session. The OOB facility must be enabled in the Rserve configuration (using `oob enable`) and the client must support OOB messages for this to be meaningful. This facility is not used by Rserve itself, it is offered to specialized applications (e.g. `Cairo` supports asynchronous notification of web clients using WebSockets-QAP1 tunnel to dynamically update graphics on the web during evaluation).

`self.oobMessage` is like `self.oobSend` except that it waits for a response and returns the response.

### Usage

    self.ctrlEval(expr)
    self.ctrlSource(file)
    self.oobSend(what, code = 0L)
    self.oobMessage(what, code = 0L)

### Arguments

`expr` | R expression to evaluate remotely
`file` | path to a file that will be sourced into the main instance
`what` | object to include as the payload fo the message
`code` | user-defined message code that will be ORed with the `OOB_SEND`/`OOB_MSG` message code

### Value

`oobMessage` returns data contained in the response message.

All other functions return `TRUE` (invisibly).

### Author(s)

Simon Urbanek

### Examples

    ## Not run:
      self.ctrlEval("a <- rnorm(10)")
      self.oobSend(list("url","http://foo/bar"))

    ## End(Not run)

[Package Rserve version 1.7-3 Index]