giodamelio
giodamelio

Reputation: 5605

Python to JavaScript Persistant connection

I have a webapp all that is communicateing with a python script via a simple HTML form(I use the bottle microframework). The problem is, creating a new request for each piece of data creates a lot of overhead.

So the question is, how can I create a persistent connection bewtween my webapp and my python program? Is there any tools or library's you would suggest?

Upvotes: 2

Views: 125

Answers (1)

CR Drost
CR Drost

Reputation: 9817

If you're sure that the connection overhead really is the part which is slowing you down, then you will have to get the Python script to run as a daemon, and you'll probably want to use it by opening a WebSocket which can hold onto your persistent connections. See for example:

http://popdevelop.com/2010/03/a-minimal-python-websocket-server/

A quick search on DuckDuckGo also turns up these examples. Good luck!

Upvotes: 3

Related Questions