Long-Polling SID from ping/disconnect and connect are not the same #1338
-
Hello, I got an AsyncServer hosted on a uvicorn web server. On my AsyncClient, after it is connected to my AsyncServer, i emit him a custom event with some data that i will store in a database. So in my server i send data to an API and i also send the sid from the event at same time so i can send custom event to this client from a web interface. When a disconnect event is handled, i send the sid of the event to my api to set client offline in my database. I have seen that when the disconnect event is handled :
I have also seen that my server, when it pings clients with long polling, it pings SIDs stored in sio.eio.socket.keys() and my SIDs from connect event are not in there so i don't know how it works but this how i found that the SID from disconnect and connect events are not the same in long polling transport. With websockets only, it works perfectly. So i you have more informations about how i can solve this and if you can tell me if this is a bug or my fault. I got socketio, engineio and uvicorn last versions. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
It would be useful to see some of your code, specifically how you determine the |
Beta Was this translation helpful? Give feedback.
-
Server.py
Connect event
Event emitted by client after he is connected to server
Disconnect event
|
Beta Was this translation helpful? Give feedback.
-
Good morning, For information, I had tested on different operating systems and different web servers and the problem was the same. Maybe I expressed myself wrongly, if I run the server and the client on the same computer, I would see the disconnection. I don't see the disconnection when I have a server and a client on two separate computers and I cut the client's wifi or ethernet. In my server log I see a "service task canceled" log and that's what makes me think that the commit could be the cause of my problem, quite simply because I think that "raise KeyboardInterrupt()" line (which is not present in version 4.5.1) break the loop. Maybe I'm wrong. And otherwise the commit does not only modify the shutdown, if you go down further you will see that the _service_task function is also modified, this function is called when a client connects in the code below:
|
Beta Was this translation helpful? Give feedback.
Good morning,
For information, I had tested on different operating systems and different web servers and the problem was the same.
Maybe I expressed myself wrongly, if I run the server and the client on the same computer, I would see the disconnection. I don't see the disconnection when I have a server and a client on two separate computers and I cut the client's wifi or ethernet.
In my server log I see a "service task canceled" log and that's what makes me think that the commit could be the cause of my problem, quite simply because I think that "raise KeyboardInterrupt()" line (which is not present in version 4.5.1) break the loop. Maybe I'm wrong.
And otherwise the commit does not only …