Class providing WebSocket connection server
The most important aspect of the API of this server are methods
send_request. These are
used to interact with the epiviz JS app through the provided websocket connection.
register_action(action, callback) registers
a callback function to be executed upon request from the epiviz JS app. When the server receives a JSON message through the websocket, it
checks for an
action field in the received request message, and then evaluates the expression
is obtained from the
data field in the received message. A response will be sent to the epiviz app with field
with the result of the callback. If an error occurs during evaluation of the callback function, the response will be sent with field
success set to
To send requests to the JS app, method
send_request(request_data, callback) should be used. This is sends a request to the JS app
data field populated with argument
request_data. Once a response is received (with field
success equal to
callback(response_data) is evaluated where
response_data is obtained from the
data field in the received
RC object with methods for communication with epiviz JS app
Check if a callback is registered for given action<character>, <logical>. (See Details)
Check if there is a sent request waiting for a response from JS app, <logical>
Check if server is closed, <logical>
Check if server is running in background, <logical>
Check if server is running in interactive mode, <logical>
Check if there is an open websocket connection to JS app, <logical>
Register a callback<function> to evaluate when epiviz JS sends a request for given action<character>. (See Details)
Run server in blocking mode
Send request to epiviz JS app with given request_data<list>, and evaluate callback<function> when response arrives. (See Details)
Listen to requests from server. Only has effect when non-daemonized
Start the underlying httpuv server, daemonized if applicable
Stop the underlying httpuv server
Stop listenning to requests from server. Only has effect when non-daemonized.
Unregister a callback function for given action<character> (if registered). (See Details)
wait_to_clear_requests(timeout = 3L)
timeout seconds to clear all pending requests.
1 2 3 4 5 6 7 8 9 10 11 12
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.