Skip to content

Add method were we can emit and listen to server  #4724

@elmcapp

Description

@elmcapp

I am using socket.io with express to create a tunnel server something like localtunnel.me I am in the need to be able to emit messages from the server and be able to listen to the emitted data in the same server. I was thinking of using io.addListener but it does not do anything.

Goal:
The server can for example io.addListener or. io.on("in_server", console.log)
The server can io.emit("in_server", "data here")
when the emit happen in the server the server can also listen.

By doing something like this I would be able to use the data outside the:

io.on("connection", (socket) => {})

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions