Right now I have a webpage with various buttons and options that I'd like to use to send commands to a python script running on the webserver. The python script is being used to interface with devices over a serial connection as well as performing computations with the data received from both the webpage and the serial connection.
I was recommended to use Node.js with socketIO to open up a socket from the front end webpage to the server. I was able to get socketio running in minutes and sending data to a javascript server. Now I tried using that server to replace my python script, but my computations were taking too long, and being single threaded was very limiting.
I'd like to revert back to my python script for handling computations(and possibly serial communications as well), but there are so many options available I don't have time to try them all and see which works best.
As of right now I'm looking at:
Javascript websockets talking directly to the python script over socket
The limitation here is that I won't be taking advantage of the scalability and power of Node.js or socket.io which would handle concurrent connections better without me having to reinvent the wheel.
Socket.io talking to a javascript socket.io server, which then relays the data over a net.Socket to the python script
Is it overkill to have that additional script just relaying information though? In my mind it would be taking advantage of all the socket.io features, but does add a layer to my web stack.
Socket.io talking directly to a python script using python-socketio
I think this makes the most sense, don't really know of any shortfalls.
Ideally the solution would have low latency, allow for data to be sent and received from the front end webpage, and allow for threading so long computations won't block processes. I do NOT need python to act as a websever, and many packages I see are being used that way. Curious as to any input you guys might have.