Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this function #3663

Closed
jonalan7 opened this issue Oct 8, 2020 · 4 comments
Closed

How to use this function #3663

jonalan7 opened this issue Oct 8, 2020 · 4 comments
Labels
question Further information is requested

Comments

@jonalan7
Copy link

jonalan7 commented Oct 8, 2020

How to use the io.in function

io.to(socketId).emit('message');

through the front-end.

@aljaxus
Copy link

aljaxus commented Nov 11, 2020

You have the docs for this.
https://socket.io/docs/v3/client-api/index.html#socket-emit-eventName-%E2%80%A6args-ack

You also disregarded the notice you had in the issue template;

Note: for support questions, please use one of these channels: stackoverflow or slack

Please just RTFM and close this issue.

@jonalan7
Copy link
Author

OK! thank you!

@darrachequesne
Copy link
Member

@jonalan7 you can only broadcast on the server-side, there's no such concept on the client-side. I will update the documentation to make it clearer.

@darrachequesne darrachequesne added the question Further information is requested label Nov 12, 2020
@aljaxus
Copy link

aljaxus commented Nov 12, 2020

Yeah looking back at it, the reply I posted above wasn't really kind, I'm sorry, @jonalan7

To make up for it, if you haven't "RTFM" yet 😛 ...

You can not emit a payload to a specific socket from client side, because your client only knows about one socket connection, the one that it has established with the server. If you want to sent some data from one client to all clients, you have to emit a specific event with the payload from the client to server, and then the server handles that event with a handler which then emits that data payload to all other sockets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants