I am looking to use Facebook's Graph API to implement real-time updates .
My web app will start out as a basic front-end that says [Page Name] has [x] likes.
What I would like to accomplish is when a user likes the page, [x]
will update accordingly and a message appears saying that the # of likes has increased. I have already implemented getting the number of likes from a page.
Ideally, I would like the update to take place when the POST
from Facebook to my callback URL is made. A suggestion I received was to set up a listener for the callback, then once Facebook makes a POST
to my callback URL, the listener will update data accordingly and interact with the front-end to update [x]
's value.
Is this possible? If so, how would I go about implementing such? I am trying to avoid a polling technique as, in a large-scale context, would constantly use resources.
According to the documentation for Real-Time updates, you can subscribe to likes by the users who has authorized your app. Not to anyone who likes a page. The page can get notified of only one thing: " For page, you will get updates about the pages which have added your application as a tab. ". So this API is not going to have that ability.
My suggestion would be to use a polling technique to get your page's number of likes using FQL via the JS SDK.
SELECT fan_count FROM page where page_id = {your page}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.