Skip to content

What happens to the queued packets when socket is reconnected? Is there even a queue for packets? #3971

Answered by darrachequesne
karagenc asked this question in Q&A
Discussion options

You must be logged in to vote

If the socket is not connected, the packet is buffered: https://github.com/socketio/socket.io-client/blob/b466c6f0b1dd5ef1a2149abc89d1884d376c0eee/lib/socket.ts#L190

If it is connected but fails to be sent at the Engine.IO level, it seems the packet is simply discarded/lost, as the writeBuffer here is not used when receiving a close event. Which is a bit surprising actually, we could maybe try to send it upon reconnection. What do you think?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by darrachequesne
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants