0

I am trying to make a web application that can run biochemical simulations, and I want to display an interactive animation of the simulation while it is running. However, the actual simulator is already made in python, and I'm worried that constantly making HTTP requests to the server for simulation results will be way too slow. Is there a way that I can have the simulation run on the client side, or access the python simulator quickly without reloading the page?

katzjm
  • 1
  • Hi @katzjm, yes these things are possible. You could implement the simulation in JavaScript to run it in the browser (client), or use something called AJAX to retrieve data over HTTP without refreshing the page. These things are not specific to python, though, and they are also very broad topics; too broad for the kind of questions we answer on this site. – rje Oct 22 '18 at 18:49
  • What rje said. Take a look at this Miguel post on [Flask with AJAX](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiv-ajax) and read about sockets. – Tom Wojcik Oct 22 '18 at 19:03
  • Is it feasible to make AJAX calls often enough to keep up with animation frame rate? Say I were to aim for 10 fps minimum, could the website keep up? – katzjm Oct 22 '18 at 19:03
  • Ok then, for that you will need polling or streaming, but imho you may not need this. You poll every n seconds or you are open for data that is streamed to you. Anyway I'm not a specialist in this topic. You may need to google that for yourself. – Tom Wojcik Oct 22 '18 at 19:42
  • Streaming socket is probably what I'm looking for. Thanks! – katzjm Oct 22 '18 at 20:47

0 Answers0