last message processed after the disconnect callback
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 63.2k
- Forks
- 10.3k
- Avg merge
- 11d 20h
- Merged PRs (30d)
- 2
Description
Describe the bug
Sometimes I noticed that the last message I sent right before terminating my app is processed by my event listener socket.on("event", () => {}) after the disconnect callback has been called socket.on("disconnect", () => {}).
This does not always happen: in my case I was able to reproduce it on my mac M1 but not on my raspberry pi.
This is a weird issue and I don't know how to reproduce it. But I am wondering if this is a know issue or if others faced the same behavior.
Expected behavior
I would expect the disconnect callback to be always call after the last message.
Versions:
- "socket.io-client": "^4.4.1"
- "socket.io": "^4.4.1"
Platform:
- Device: Macbook air M1
- OS: Macos
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the socket.on("event") and socket.on("disconnect") callbacks described in the report, using socket.io-client and socket.io 4.4.1. Try to create a minimal reproduction on macOS and compare its event ordering with the Raspberry Pi case. Done means determining whether disconnect ordering is guaranteed and, if it is a bug, identifying a reproducible regression case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100