starscape
starscape

Reputation: 2983

Is it possible to use Node.js socket.io with a web application written in python?

I have a website written in python(flask) which I would like to some realtime functionality to. I have looked at some websockets implementations for python, but none of them seem as straightforward and simple as socket.io for Node.js.

Is it possible(and furthermore, practical) to write the realtime component in Node.js and integrate with python(e.g., when a page is hit in the python code, execute this node.js function), or is it just a waste of time?

any help is appreciated!

Upvotes: 0

Views: 224

Answers (1)

Peter Lyons
Peter Lyons

Reputation: 146084

Is it possible? Yes. For example, you could have a web server route the websocket-related paths to node.js/express and the rest of them to your python/flask app. Is it practical? Probably not, but it's a case-by-case judgement call. How cleanly separated are the real-time vs traditional aspects of your application? At the end of the day if your integration between 2 daemons in 2 different languages is significantly more complicated that just finding or writing a working python websocket implementation, you might want to stick with python.

Upvotes: 1

Related Questions