flask-uwsgi-websocket
flask-uwsgi-websocket copied to clipboard
ws connection failed
I don't know the reason why the connection failed
chrome:

shell:

code:
from flask import Flask, render_template
from flask_uwsgi_websocket import WebSocket
app = Flask(__name__)
ws = WebSocket(app)
@app.route('/')
def index():
return render_template('test2.html')
@ws.route('/websocket')
def echo(ws):
while True:
msg = ws.receive()
if msg is not None:
ws.send(msg)
else:
return
if __name__ == '__main__':
app.run(debug=True, threads=16, port=8080)
+1, same problem with 0.6.1
+1 with 0.5.3 on Py3
Same here unfortunately
i fix this problem,this is mainly the high verison flask need a high version werkzeug. But the high version werkzeug added a judgment on whether the request is websocket。so the add_url_rule need change: old: rule = Rule(rule, methods=methods, **options) new: rule = Rule(rule, methods=methods, websocket=True, **options)