`epivizrServer` Usage

knitr::opts_chunk$set(echo = TRUE)

The r Biocpkg("epivizrServer") package includes methods providing WebSocket connection server and request/response message handling for the epiviz JS application http://epiviz.github.io. These functions have been extracted from the r Biocpkg("epivizr") Bioconductor package into its own package for easier use and maintenance.

It is based on the r CRANpkg("httpuv") package, which provides an interface to the libuv networking library.



# create the server (but it's not started yet)
# it can serve static html files as well
# using the 'static_site_path' argument
server <- createServer(port=7123, verbose=FALSE)

# register a callback to evaluate when a request with given action
# is received
server$register_action("getData", function(request_data) {

# start the server

# send a request with callback to evaluate when successful response is received
server$send_request(list(x=2,y=5), function(response_data) {

# in Windows platform this is required to listen and respond to requests

# when done, stop the server

# in interactive sessions it is good practice
# to add a `stop_server` call to the R exit hooks
# to relase network port used

Try the epivizrServer package in your browser

Any scripts or data that you put into this service are public.

epivizrServer documentation built on Nov. 8, 2020, 11 p.m.