-
-
Notifications
You must be signed in to change notification settings - Fork 570
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
Disconnection support from server #1
Comments
In the |
Disconnect (in my case) is require also in others function that the connect (i don't have all the users information during the initial connection, only after the auth process.). So returning False is not enough :) |
Yes, I agree that |
This is now available. Closing. |
Just wondering how it is implemented eventually, closing the socket connection or faking disconnect? Thanks. |
@QuingZ This discussion was regarding disconnecting from the client. Disconnecting from the server has been implemented long ago and as far as I know works fine. If you try the example in this app, there is a disconnect button that triggers a server-initiated disconnection. |
I am using python-socketio-client to connect to server. After socketio.disconnect() is invoked from server, the client can receive "disconnect" message. However, when checking the socket connection by "ss -at", I found that the socket is not closed unless the client process is closed or terminated. My question is that, does disconnecting from the server close the tcp socket, or just keep the socket open but doesn't let any messages in or out? Thanks. |
That really depends on the WebSocket implementation. This package is not managing the connection at the socket level, it relies on a base WebSocket implementation to do that, and there are currently three of these that are supported. I guess it is possible that when the connection ends there is no proper cleanup of the underlying socket, but that would be something to investigate on the particular WebSocket implementation you are using (eventlet, gevent or uwsgi). |
I see. I am using eventlet, seems it doesn't close socket properly. I will do same research on it, hopefully can find something. |
There is no current way to stop a connection of a client from the server.
Flask socketio have a
disconnect
function that can be used to stop the connection of the current client. This can be used in few cases like when the authentication failed, etc.Ref: https://flask-socketio.readthedocs.org/en/latest/#flask.ext.socketio.disconnect
The text was updated successfully, but these errors were encountered: