简体   繁体   中英

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(eg, 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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM