WebSocket works offline, (partly) online or not at all. Ends up in default unauth handler #1938
Unanswered
MediumKoItCases
asked this question in
Q&A
Replies: 1 comment 6 replies
-
You are going to have to make an effort to explain more clearly what issue do you have. Most of the things you have included above you seem to indicate they work okay. You make a reference to a Also, please see the troubleshooting page in the docs to learn how to enable logging, which can be helpful for me to understand the problem better. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Building a community platform where I have a simple chat function (live). Locally all works perfect. I am hosting on Heroku, ProcFile:
web: gunicorn --worker-class eventlet -w 1 app:app
Flask-SocketIO==5.0.0
python-socketio==5.7.2
eventlet==0.30.2 (0.33.3 seems to be having issues)
gunicorn==20.0.4
werkzeug==2.0.3
running app , and socket config like so:
sio = SocketIO( app, cors_allowed_origins=['https://www.xxx.app', 'https://xxx.herokuapp.com'] )
Online on both the main url, as the added domain I see in the heroku logs that polling and other get and post requests are going OK 200:
2023-02-06T01:11:25.619008+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=4&transport=polling&t=OOaHnkY&sid=H3mCpInX4Aq4nRu0AAAA" host=xxx.app request_id=108a569e-3708-45e7-bbfd-f3fdad8383d7 fwd="85.149.1.211" dyno=web.1 connect=0ms service=1ms status=200 bytes=283 protocol=https
2023-02-06T01:11:25.570844+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=4&transport=polling&t=OOaHnjS&sid=H3mCpInX4Aq4nRu0AAAA" host=xxx.app request_id=6e811a98-740c-42e4-bb92-9095f1361faf fwd="85.149.1.211" dyno=web.1 connect=0ms service=1ms status=200 bytes=315 protocol=https
However, on 'connection' and when triggered on a custom event, I initially received an error, took another look and noticed that @login_required is not valid method on socket routes. Hence, my editing along the way.
Once the user lands on the page that loads the front-end JS socket connecting, It seems the connection is instantly terminated. As my code assumes the SID id is in the list of connections, I am receiving an error on the back-end at the DC method. I fixed the error, so no back-end errors on disconnect.
Now, both the get and post polling requests are status 200 OK. But the 'custom_event' on click submission is not triggered on the server. It seems there is no connection between the server and the client.
JS Shows (fixed JS error): no errors in front-end
Beta Was this translation helpful? Give feedback.
All reactions