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

Only broadcasts? No function to send to a particular socket. #20

Closed
ynkm169 opened this issue Aug 9, 2014 · 5 comments
Closed

Only broadcasts? No function to send to a particular socket. #20

ynkm169 opened this issue Aug 9, 2014 · 5 comments

Comments

@ynkm169
Copy link

ynkm169 commented Aug 9, 2014

normally within 1 node instance you could:
emit message from sockets[A] --->node instance -->sockets[B]
emit message from sockets[B] --->node instance -->sockets[A]

now, when i have 10 node instances, client A and client B on different instances, how do I send a message from A to B? Redis seem to only do broadcast.

PS: it seems if you do this on RedisStore it works:
socket.broadcast.emit('msg', data);
but how do I do
sockets[B].emit('msg', data);

@olive75
Copy link

olive75 commented Aug 9, 2014

You can do io.to(id).emit('event', data)

@ynkm169
Copy link
Author

ynkm169 commented Aug 9, 2014

that would be fantastic!

Thanks for helping I will try it out.

Sent from my iPhone

On Aug 9, 2014, at 5:38 PM, "olive75" notifications@github.com wrote:

You can do io.to(id).emit('event', data)


Reply to this email directly or view it on GitHub.

@rase-
Copy link
Contributor

rase- commented Aug 22, 2014

What @olive75 suggested should indeed do the trick. Did you try that out, @ynkm169?

@ynkm169
Copy link
Author

ynkm169 commented Aug 22, 2014

I think it worked. thanks! @rase-

@rase-
Copy link
Contributor

rase- commented Aug 22, 2014

Awesome. Closing as it seems solved.

@rase- rase- closed this as completed Aug 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants