-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
Handling ConnectionRefusedError from python-socketio[client] #344
Comments
I also just ran across this. I don't see an easy way to get notified about this. |
You can now define a @sio.event
def connect_error(message):
print('Connection was rejected due to ' + message) |
I'm using this with flask-socketio, and the connection stays alive. I'm only getting |
@YuqiaoS I don't understand. There is no |
@miguelgrinberg Well I'm using flask-socketio and what I'm seeing, as I have verified again, is that on 4.3.1 python-socketio, I get the |
@YuqiaoS What you are claiming cannot really be true. On the 4.3.1 release there is no |
@miguelgrinberg Wanna bet :) Switched to mac. I assert the above. You could easily verify with the socketio js client. |
@YuqiaoS there's nothing to bet. In 4.3.1 the I don't understand what you want me to try. I asked for a code example, you haven't provided any. |
You will get a
As for code, I've already said to use js client and verify. I've verified 3 times already, each with 3 versions. |
@YuqiaoS you realize you are asking in the Python project, right? If you say "I get the connect_error event on the client" on this issue tracker the assumption is that you are talking about the Python client. How am I supposed to know that you are talking about someone else's client? I have nothing to offer if you are having problems with the JS client, not my project. I've also asked several times that you provide sample code, which would have settled this misunderstanding and so far you have not done so. |
Well I thought flask-socketio is normally used with the web. Your site says: The 4.4.0 python-socketio release has problems I mentioned above when you raise |
This is the issue tracker for python-socketio. Flask-SocketIO is a Socket.IO server. This repository has a server and a client, both written in Python.
You have provided no code for me to use to verify and debug the problem you reported, even though I asked several times already. I don't think it is fair of you to expect I will sit down and write a test server and a test client based just on your written description, on the chance that it will match yours and hit the same issue. If you want me to look at your issue you have to save me some time. |
Open browser inspector tool, go to python
js
|
I found that there is no way to have notified when the server rejects connection (or at least joining a namespace.) Am I missing something, or will this have to be implemented in some way?
From
socketio.client.Client._handle_eio_message
, when thepacket_type
ispacket.ERROR
, it will call_handle_error
withoutpkt.data
.python-socketio/socketio/client.py
Lines 587 to 588 in a839a36
Moreover, it does not let the user know if an error has gone through the handler.
python-socketio/socketio/client.py
Lines 501 to 509 in a839a36
Workarounds
_handle_error
:pkt.data
is missing, so the details won't be available._handle_eio_message
: Introduces double decoding of packets, thus giving performance impacts.Example server namespace code
Client log output:
The text was updated successfully, but these errors were encountered: