Skip to content

Messaging protocol and pipeline

Cyrille Rossant edited this page Aug 24, 2013 · 1 revision

Messaging protocol

Python to JS

  • JSON string with a list of GL commands.
  • GL command name and arguments.
  • Arguments are serialized. NumPy arrays are serialized in a special format (with shape, data type, base64-encoded data buffer).

JS to Python

  • User events: mouse, keyboard...

Pipeline

  • Python script with use('web') backend.
  • All GL commands are recorded (lazy evaluation), e.g. in two lists:
    • init_commands
    • paint_commands (flushed as soon as they are sent to the browser)
  • The script ends with "show()" which fires up a server.
  • Then, one needs to run the browser. The page connects to the Python process through WebSockets.
  • Upon initialization, Python sends the init_commands and paint_commands to the browser, which executes them. Also, paint_commands is flushed.
  • Upon user interaction, JS sends user events to Python.
  • Python processes the user events, and triggers the corresponding Vispy events. All paint_commands are recorded, and sent back to JS.
Clone this wiki locally