Client cannot recognize failed connect #4539
Unanswered
wmorgansoftware
asked this question in
Q&A
Replies: 1 comment
-
OBE; I was not using on('connect_error'). Still having issues with the server throwing tracebacks, but that's not socket.io's problem, so this can be closed. |
Beta Was this translation helpful? Give feedback.
0 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.
-
I'm doing some development using flask-socketio and socket.io-client, most recent versions as of the time this was written; Python 3.10. With a successful connection, I'm not having any problems with communicating between server and client. However, I'm running into some issues when I intentionally fail the 'connect' event on the server side (happens with both a "return False" and raise of the ConnectionRefusedError from flask-socketio, obviously changing the name to not conflict with Python's built-in).
On Firefox, I see the following:
Firefox can’t establish a connection to the server at ws://127.0.0.1:5000/socket.io/?EIO=4&transport=websocket&sid=knBqXuIQnfdUhrAKAAAC. websocket.js:54:26
The connection to ws://127.0.0.1:5000/socket.io/?EIO=4&transport=websocket&sid=knBqXuIQnfdUhrAKAAAC was interrupted while the page was loading. websocket.js:54:26
In addition, server-side errors of:
simple_websocket.ws.ConnectionClosed: Connection closed: 1005
OSError
(not sure if the full stack-trace is needed)
On the Chromium side of things, there's no server error, but on the client I am seeing:
websocket.js:54 WebSocket connection to 'ws://127.0.0.1:5000/socket.io/?EIO=4&transport=websocket&sid=fQgITd3EwkgSil7pAAAE' failed: Invalid frame header
Any thoughts as to why I would be seeing this, as well as what I could do to resolve? I haven't had issues with previous versions that are now outdated; they just went right to the disconnect handler so I could redirect to another path. Obviously I'm trying to intentionally fail the connection if someone isn't logged in, making them do so first. Here's how I'm calling things client side:
Beta Was this translation helpful? Give feedback.
All reactions