Learn R Programming

emuR (version 0.1.7)

serve: Serve EMU database to EMU-webApp

Description

Serves emuDB media files, SSFF tracks and annotations for EMU-webApp browser GUI http://ips-lmu.github.io/EMU-webApp/

Instructions:

Start and connect:

  • Call this function to start the server.
  • Start a suitable HTML5 capable Web-Browser (Google Chrome, Firefox,...).
  • Navigate to the EMU-Webapp URL:http://ips-lmu.github.io/EMU-webApp/.
  • Press the 'Connect' button in the EMU-webApp and connect with default URL.
  • EMU-webApp loads the bundle list and the first bundles media file, SSFF tracks and annotations.

Disconnect and stop:

  • Disconnect and stop the server with the 'Clear' button of the webapp or the reload button of your browser.
  • The server can also be interrupted with Ctrl-C if something wents wrong.
  • To serve only a subset of sessions or bundles use the parameterssessionPatternand/orbundlePattern.

Usage

serve(emuDBhandle, sessionPattern = ".*", bundlePattern = ".*",
  host = "127.0.0.1", port = 17890,
  autoOpenURL = "http://ips-lmu.github.io/EMU-webApp/?autoConnect=true",
  debug = FALSE, debugLevel = 0)

Arguments

emuDBhandle
emuDB handle as returned by load_emuDB
sessionPattern
A regular expression pattern matching session names to be served
bundlePattern
A regular expression pattern matching bundle names to be served
host
host IP to listen to (default: 127.0.0.1 (localhost))
port
the port number to listen on (default: 17890)
autoOpenURL
URL passed to browseURL function. If NULL or an empty string are passed in browseURL will not be invoked.
debug
TRUE to enable debugging (default: no debugging messages)
debugLevel
integer higher values generate more detailed debug output

Value

  • TRUE if the database was modified, FALSE otherwise

Details

Function opens a HTTP/websocket and waits in a loop for browser requests. Parameter host determines the IP address(es) of hosts allowed to connect to the server. By default the server only listens to localhost. If you want to allow connection from any host set the host parameter to 0.0.0.0. Please note that this might be an safety issue! The port parameter determines the port the server listens on. The host and port parameters are intended only for expert users. When started the R console will be blocked. On successfull connection the server sends the session and bundle list of the database referenced by name by parameter dbName or by UUID parameter dbUUID. The Web application requests bundle data for viewing or editing. If a bundle is modified with the EMU-webApp and the save button is pressed the server modifies the internal database and saves the changes to disk. Communication between server and EMU webApp is defined by EMU-webApp-websocket-protocol version 0.0.2.

Examples

Run this code
## Load EMU database 'myDb' and serve it to the EMU-webApp (opens default HTTP/websocket port 17890)

myDb = load_emuDB("/path/to/myDb")
serve(myDb)

Run the code above in your browser using DataLab