Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
3 replies
test_1

instagram-reddit type app with socket io

so i am making an instagram/reddit type app where its just a bunch of posts and likes/dislikes/comments
I want to implement web sockets so that you can see the likes and dislikes for every post updating live instead of having to refresh page

so one way i can do that is when each time a person likes/dislikes then the server will emit to all the other clients and update their data

but this isn't efficient because I imagine a big app like instagram has thousands of likes and dislikes per minute and the person loading the data isnt actually loading all the posts that exist

so how do i only emit for the posts that the person is currently viewing so that his client only updates the likes/dislikes for them and not every post that exists?
Was this page helpful?