Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ws connection failed #81

Open
hbo-lambda opened this issue Jun 8, 2021 · 4 comments
Open

ws connection failed #81

hbo-lambda opened this issue Jun 8, 2021 · 4 comments

Comments

@hbo-lambda
Copy link

hbo-lambda commented Jun 8, 2021

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)
@hnmzzzxxl
Copy link

+1, same problem with 0.6.1

@ptallada
Copy link

ptallada commented Dec 28, 2021

+1 with 0.5.3 on Py3

@JortdeBokx
Copy link

Same here unfortunately

@Rmond
Copy link

Rmond commented May 26, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants