views:

11

answers:

1

this is a generic question about a facebook application creation.

I want the user to have a who's online component that shows who's among his friends are currently using the application.

does it mean that i actually need to store each user's friends list in my own database and to filter from that the users that are currently using my application ?

that seems like a lot of work.

it even means that each time that the user uses my application i should fetch and store his friends list all over again just to make sure it wasn't changed.

is there any other way?

as you see i didn't explained what programming language i use because i think it's irrelevant to the question.

thanks!

+2  A: 

No need to store friend ids as you can get this info from Facebook (by running FQL on friend table). Just store user ids who are currently logged in (probably need last_seen timestamp on user table, then searching for users who were interacting with the app withing last 15 min).

So, something like this:

  • Whenever a user interacts with the app update user's last_seen timestamp
  • On user login retrieve friend ids through FQL and store them in a session if you don't want to retrieve this list every pageview (friend list most likely won't change during login session)
  • Search for friend ids among currently active users when needed
serg

related questions