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

Example Error #5

Closed
jacektrocinski opened this issue May 17, 2021 · 6 comments
Closed

Example Error #5

jacektrocinski opened this issue May 17, 2021 · 6 comments
Labels
question Further information is requested

Comments

@jacektrocinski
Copy link

The example code does not work.

I have tried running the code in the example folder and have received the following error:

Firefox can’t establish a connection to the server at ws://localhost:5000/echo.

However, the following command does work:

wscat --connect ws://localhost:5000/echo

I have installed the following Python packages:

$ pip freeze
click==8.0.0
colorama==0.4.4
Flask==2.0.0
flask-sock==0.3.0
h11==0.12.0
itsdangerous==2.0.0
Jinja2==3.0.0
MarkupSafe==2.0.0
simple-websocket==0.2.0
Werkzeug==2.0.0
wsproto==1.0.0
@miguelgrinberg
Copy link
Owner

miguelgrinberg commented May 17, 2021

What did you type in the address bar in Firefox? You should use http://localhost:5000, since you are requesting a web page. The JavaScript code in this application will make the WebSocket connection.

@miguelgrinberg miguelgrinberg added the question Further information is requested label May 17, 2021
@jacektrocinski
Copy link
Author

Yes, that is what I did, you can see the error here:

image

Here are the exact steps to reproduce the issue, in the example folder:

$ py -m venv venv
$ py -m pip install flask
$ py -m pip install flask_sock
$ py -m pip install "werkzeug>=2.0.0rc3"
$ FLASK_APP="echo.py" flask run
 * Serving Flask app "echo.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [17/May/2021 16:46:08] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2021 16:46:08] "GET /echo HTTP/1.1" 400 -

@miguelgrinberg
Copy link
Owner

Okay, thanks. I've found the problem, it is a bug in the Werkzeug changes I contributed. See pallets/werkzeug#2131.

I'll work on a fix.

@jacektrocinski
Copy link
Author

Ok, thanks Miguel.

@miguelgrinberg
Copy link
Owner

A fix for this issue has been committed to Werkzeug towards the 2.0.2 release. You can verify the fix by installing Werkzeug's 2.0.x branch (or wait until a new release is made).

@jacektrocinski
Copy link
Author

Confirmed, installed the 2.0.x branch and it is working, thanks!

py -m pip install -U https://github.com/pallets/werkzeug/archive/2.0.x.tar.gz

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

No branches or pull requests

2 participants