Sending data to a Firefly server via Flask

Warning

To send data to an active Firefly webserver you will need to launch Firefly using a method involving Flask.

When Firefly is hosted with a Flask webserver a localhost:xxxx/data_input endpoint is exposed through which new particle data, settings, and tween params can passed to an active Firefly visualization.

Using this endpoint, it is possible to circumvent the need to output data to .json files entirely, instead creating a Python string (formatted to contain the .json data that would’ve been written to disk) that is POST’d to the data input endpoint using the requests Python module.

To facilitate this, we provide the firefly.data_reader.Reader.sendDataViaFlask() method, which will output the data contained in a Reader instance to a JSON string and then POST it to the data input endpoint of the specified localhost port.