Skip to content

Function after socket.emit is not executed #3873

Open
@Behinder

Description

@Behinder

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions