问题
I am using FQL to query . I want to repeat the query every 15 mins and see if any change occurs. So ideally i want to do a FQL query, wait 15 mins do same query again etc...
Is there any way i can use Push notifications to do it? I read about real time facebook api, but I am not sure it can be implemented with FQL..
Thanks!
回答1:
No, the Real-time Updates are only for graph objects, and according to the documentation only for the User, Permissions and Page objects (and then not to all fields or connections).
Since FQL is just another api to get data from facebook, the data from it and from the graph api is the same.
You should be able to register to a real-time update (if it's supported for what you need) and when that arrives you can then issue a FQL request to get the data in the way you want/need/used to, that way you won't "waste" FQL requests when there's no change.
Edit
The online_presence
is problematic since you can't access that from the graph api and so you don't have much choice but to periodically send that fql request.
But keep in mind that even with that solution you should not always expect to get the right answer, as you can see in this bug report: online_presence returning null (which is set to fixed, but look at the comments, also from my own experience I can say that the data returned is very inconsistent).
More than that, the online_presence
means online in the fb chat and not online on facebook:
The user's Facebook Chat status. Returns a string, one of active, idle, offline, or error (when Facebook can't determine presence information on the server side). The query does not return the user's Facebook Chat status when that information is restricted for privacy reasons.
If that's what you're looking for then you might want to consider using the Chat API which let's you log in as the user to the facebook chat servers using xmpp.
With this solution you won't have to make requests to fb asking if someone is online, the presence messages will be pushed to your client.
来源:https://stackoverflow.com/questions/10879123/get-fql-real-time-updates