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 receive/emit to a particular user? #71

Closed
harishankards opened this issue May 21, 2018 · 3 comments
Closed

How to receive/emit to a particular user? #71

harishankards opened this issue May 21, 2018 · 3 comments
Labels
question 🤔 Further information is requested

Comments

@harishankards
Copy link

Hi @probil,

Hope you are doing good. Now, I have a use case for having a pushing notification to the particular user and also in future I might implement chat system.

In that case, I would have to emit/receive data to a particular user right. How would I achieve it with the package? If you could throw me some docs or examples, would be useful.

@probil
Copy link
Owner

probil commented May 21, 2018

Hi, @harishankards
Yeah I'm fine and you? Nice to see your question again :) I can't respond you right now but I hope you can wait few hours.

Btw, I've created gitter chat for library discussion. Feel free to join it

@probil probil added the question 🤔 Further information is requested label May 21, 2018
@probil
Copy link
Owner

probil commented May 21, 2018

Basically, it's not the client library job to deliver data to the particular user. The server should do that. All clients connected to socket.io have unique ids so the server could identify them.
There is also a method on the server that allows sending events directly to the connected user by his id. Simplified flow:

=> client emits event (e.g. { message: 'Hi there', forUser: 15 })
=> server validates event and looking for socket id (e.g. haxf0EcykhJ6) by user id (e.g. 15)
=> server delivers a message to end user (using the id, e.g. haxf0EcykhJ6)
=> end user accepts message using vue-socket.io-extended listener
Also, it's possible to use rooms but it's more advanced topic.

I'm sure there are tons of info on the internet about this topic. Try googling "chat socket.io". The only difference is on the front-end but it's minor and easy understand how to port existing article examples to vue-socket.io-extended

If you have any troubles - let me know :)

@probil
Copy link
Owner

probil commented May 26, 2018

I have to close your question because it's not actully issue or bug or feature request. It's not even directly related to vue-socket.io-extended.
Let's continue discussion in gitter chat.
Please create new issue if you have any other questions :) I will be glad to help you 🤝

@probil probil closed this as completed May 26, 2018
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

2 participants