Function after socket.emit is not executed
Open
Nobody has claimed this yet.
bug
needs investigation
- Dominant language
- TypeScript
- Stars
- 63.2k
- Forks
- 10.3k
- Avg merge
- 11d 20h
- Merged PRs (30d)
- 2
Description
Describe the bug
After socket emits error there is no code executed after that.
To Reproduce
My code is for work with Twitter stream
Server
.stream
.on("data", (data) => {
console.log("pojawily sie jakie dane");
try {
const json = JSON.parse(data);
if (json.connection_issue) {
socket.emit("error",json);
reconnect(stream,socket,token); //not executed
} else {
if (json.data) {
socket.emit("tweet",json);
fs.appendFileSync("log.txt",json); // not executed
}
else {
socket.emit("AuthError",json);
console.log("trying to reconnect"); //not executed
reconnect(stream,socket,token,timeout); //not executed
}
}
Expected behavior
Normal code execution
Platform:
- Device: VPS
- OS: Ubuntu 18.04
Additional context
Add any other context about the problem here.
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 server-side stream data handler shown in the issue and reproduce the behavior around each socket.emit call. Compare the observed control flow with the expected execution of the following statements; done means the reported case is understood and the handler's behavior is covered by a verified reproduction or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100