Search code examples
pythonflaskrobotics

Faster Web to Python Communication


I am using a flask app to controll a robot via and arduino. It works like this.

Web Interface <--> Flask server and robot code <--> Arduino powered robot

I am using a simple html form to send text commands. The problem is, for a robot, submitting html forms is not quite a fast enough form of communication. I would like to keep the remote web-based for portability(I want to be able to use it on a both my computer and my iPhone from the same LAN).

So the question is, is there a faster way for my python script to communicate with my webapp?


Solution

  • Well, I don't know what leads you to believe that the process of submitting web forms is the problem. Without that information, it is difficult to suggest anything at all.

    About the best I can suggest is that if you keep a persistent connection, both sides could send each other json fragments over the one connection, thus avoiding the overhead of creating a connection each time.

    Another alternative, if your data are simple, is toencode them in the url.