Skip to content

Calling socket.emit('error') on server always throws error #2285

@nick-allen

Description

@nick-allen

From the server, attempting to call socket.emit("error", payload); always throws an error. This occurs whether the connect client socket has an handler for the 'error' event or not.

> io = require('socket.io').listen(3000)
### Connect a client ###
> socket = io.sockets.sockets[0]
Socket {
...
}
> socket.emit("error", "Message");
Error: Uncaught, unspecified "error" event. (Message)
    at Socket.emit (events.js:144:17)
    at Socket.emit (<PATH>/socket.io/lib/socket.js:129:10)
    at repl:1:3
    at REPLServer.defaultEval (repl.js:164:27)
    at bound (domain.js:250:14)
    at REPLServer.runBound [as eval] (domain.js:263:12)
    at REPLServer.<anonymous> (repl.js:393:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions