简体   繁体   中英

Socket.io python server

I am using https://github.com/invisibleroads/socketIO-client to have my Node.JS server communicate with a Python Backend.

However, this is a bit tricky because I actually want to use my Python as a backend, and it makes more sense to have Python act as a server and Node.JS act as a client. Ideally, Node.JS code initiates the connection to the Python code, and Python Code returns something.

Although there is a socket.io-client library for Node.JS, I couldn't find a simple socket.io server library for Python.

As an alternative, how can I have the socket.io server initiate the message (ie emit()) to the client?

Oops, reading the bottom of https://github.com/learnboost/socket.io/wiki reveals that

http://github.com/abourget/gevent-socketio

does the trick. There is also a https://github.com/evanw/socket.io-python library that is deprecated because of an outdated socket.io

gevent-socketio is no longer actively supported (last commit Jan 2014).

The new player is Flask-SocketIO :

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