I'm trying to get eventlet
working with flask-socketio
in python 2.7. Here is the bare bones code I am using:
import eventlet
from flask import Flask
from flask_socketio import SocketIO
import threading
import time
def server():
app = Flask(__name__)
app.config['SECRET_KEY'] = 'asdf'
socketio = SocketIO(app, host = '0.0.0.0')
socketio.run(app)
server_thread = threading.Thread(target = server)
server_thread.start()
while True:
time.sleep(1)
When I run this on my laptop, this seems to work (flask-socketio
uses eventlet
). But when I run this on the embedded device it's intended to run on, I get the following message:
WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance.
There are definitely different package versions between the two systems, and I suspect that is the reason for the failure. Here are the packages on the embedded system:
click==6.7
eventlet==0.18.4
Flask==0.12.2
Flask-SocketIO==3.3.2
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pyserial==3.4
python-engineio==3.5.2
python-socketio==4.0.2
six==1.11.0
smbus==1.1
Werkzeug==0.12.2
Does anybody know why flask-socketio
would fail to use eventlet
with these versions?
Also, I don't know if it's related, but the host = '0.0.0.0'
is also being ignored (on both my dev machine and the embedded machine). It's running on 127.0.0.1 always.
Any ideas?