Skip to content

Emitting emissions outside of actions/hooks #188

Answered by RobinTail
zoton2 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @zoton2 ,

an HTTP API request that is sent to the server that then looks up a client based on metadata

It's not supposed to work that way. HTTP server is only used as transport and for handshake to upgrade the connection to websockets. Moreover, "look up a client" means that there is a client, so that it is expected to be already connected via sockets. Therefore:

The other way of doing this ... would be to convert the HTTP API call to a socket action

— that's exactly what I'd recommend to do.

So, you don't need to do any lookups. Your client emits the event (action), and you handle that action by emitting another event towards the original event owner (client). You'd not even ne…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@zoton2
Comment options

@RobinTail
Comment options

@RobinTail
Comment options

@RobinTail
Comment options

@RobinTail
Comment options

Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issue Good for newcomers
2 participants