I am developing an app where users can post. I want to alert users when a new post is submitted that they have not seen. The whole process is basically the way facebook is set up. However, I was wondering how I keep track of posts users have seen already.
How does facebook accomplish that?
Whenever a user views a post (makes a request that returns said post), add an entry to the
viewstable. Here’s a simple diagramThat way you’d know which user viewed what. Additionally you can add a
timestampfield to keep track of when the user viewed the post.So if you you wanna know who viewed the post
666you can simplyYou can also check if a user viewed a certain post so you can decided whether to alert him or not
And you can work a simple logic
Note: This isn’t really how Facebook does it, as this method doesn’t scale pretty well. But this is the basic idea.