This repository contains the code for a websocket server, which can be used to distribute Vega-lite specifications in realtime across multiple, parallel revize-enabled visualization clients.
Clients that wish to connect to this server need to implement the websocket interface of revize version 1.0.4 or higher.
RevizeServer uses Python 3.8.5
. We recommend setting up an (optional) virtual environment for the packages.
The project mainly builds on the flask-socketio package to create a server for synchronizing vega-lite specifications over websockets and control the toolchain over http.
To install all dependencies, run the following pip command on a terminal inside this directory:
pip install -r requirements.txt
With all dependencies installed, the server can be launched by running the following command inside this directory:
python server.py
This will launch a websocket server on localhost:5000
for revize clients to connect to, as well as a flask that receives HTTP requests.
The default websocket namespace for serving vega-lite specs is "/test"
.
The testing environment can be reached through the browser on http://localhost:5000.
The server provides a lightweight websocket and HTTP interface for synchronizing vega-lite specifications. All endpoints are listed below. HTTP endpoints have the HTTP prefix, websocket endpoints are not particularly marked.
The following endpoints allow to set up the toolchain, before any Vega-Lite specifications can be exchanged.
Registers a new client in the workflow and shares the latest version and the latest Vega-lite specification with that client.
- The
id
property must contain a number, for example drawn from a random sample.
Unregisters a client from the workflow. This endpoint takes has no parameters.
Informs the server about a tool id
that will register in the future.
By using this endpoint for multiple tools, the toolchain can be configured without having to start each tool.
- The
id
property must contain a number, for example drawn from a random sample.
Retrieves the alive-status of a particular tool, by checking whether a client using the given id
has registered.
If a client has registered, the server responds with ready
, and if not, the server responds with not ready
.
- The
id
property must contain a number, for example drawn from a random sample.
The following endpoints allow sending Vega-Lite specifications to other registered and connected tools.
Sends the Vega-Lite specification spec
to the server, without updating other tools.
spec
must contain a valid Vega-Lite specification (no server-side validation!).
Sends the Vega-Lite specification spec
to the server and triggers an update for all registered tools.
spec
must contain a valid Vega-Lite specification (no server-side validation!).
Distributes the Vega-Lite specification that the server received the latest to all registered clients. This endpoint takes has no parameters.
Sends the Vega-Lite specification that the server received the latest to the tool registered under the given id.
target_id
must contain a number, for example drawn from a random sample.