我正在尝试从Brython创建一个Websocket连接到运行Flask和Flask的本地服务器。Brython代码可以连接到Websocket回送服务器,但是当尝试使用本地服务器时,它会失败,错误代码为“WebSocket握手中的错误:意外响应代码: 200”。
在客户端(使用Brython):
def open_connection(event):
global ws
if not websocket.supported:
alert("WebSocket is not supported by your browser")
尽管使用了SocketIO (),但我在使用socketio.run()的情况下运行socketio.run和Eventlet时遇到了困难,任何建议都很感激。我目前正在使用Python3.9,并且我尝试了每个模块的多个不同版本,但都没有效果。
[2021-04-04 06:39:05,709] WARNING in __init__: Flask-SocketIO is Running under Werkzeug, WebSocket is not available.
"GET /socket.io/?EIO=4&transport=websocket HTTP/1.1
我已经尝试了6+几个小时了。我正在使用Flask-SocketIO和原生react来尝试让测试设置正常工作。似乎有一些监听程序不工作。下面是我的代码:
SERVER SIDE PYTHON FILE (running on flask development server)
@socketio.on('connect')
def connect():
print('listening to connect')
@socketio.on('emission')
def emission(data):
print('l