Thursday 17 May 2018

How exactly to use socket.io for my purpose?

So i don't have much knowledge regarding socket.io. I have a users collection and a posts collection. The posts collection has a reference to _id from the users collection. My requirement is that once the user logs into a webpage, he must be only shown his posts (being updated live) using socket.io. Eg. user A after loggin in should see user A's post's. user B after loggin in should see user B's posts and so on. Now i've looked in to rooms in socket.io and was wondering how to go about this? How should i associate each user's socket with his _id so that he can only see his posts.Thanks

Submitted May 17, 2018 at 07:30PM by mclovin4009

No comments:

Post a Comment