FB Realtime API not/inconsistently notifying for c

2019-03-23 09:39发布

问题:

I'm currently running into an issue with Facebook's realtime API.

I wish to subscribe to a number of things on a users profile, including their "Likes" in the Music, Books, TV and Movies categories.

I get the correct information when I query via FQL and the Graph, but Facebook is not pinging my notification endpoint when those entries change on a users profile.

The subscription and verification are fine. Here is the active subscription from Facebook from my App:

["object"]=> string(4) "user"
  ["callback_url"]=> <correct callback URL>/facebook/update/"
  ["fields"]=>array(11) {
    [0]=> string(13) "birthday_date"
    [1]=> string(5) "books"
    [2]=> string(10) "first_name"
    [3]=> string(7) "friends"
    [4]=> string(5) "likes"
    [5]=> string(6) "movies"
    [6]=> string(5) "music"
    [7]=> string(4) "name"
    [8]=> string(3) "sex"
    [9]=> string(2) "tv"
    [10]=> string(8) "username"
  }
  ["active"]=> bool(true)

At first I had not subscribed to likes but added that on to see if it fixes the problem... It has not.

The documentation says:

Here are the list of user connections to which you can subscribe: feed, friends, activities, interests, music, books, movies, television, likes, checkins

I get notification when any of that data changes (including friends), it's just the music, books, movies and television.

Perhaps even more strangely, when I "Like" a random Facebook page (i.e. using a like button, not adding it to a field on my profile) I get a notification triggered on the like field. When I unlike the same page, I get a notification triggered on likes, music, books, movies and television!

Needless to say, I'm confused. Has anybody run into this or can suggest a place to start looking to fix it?

EDIT: After some further test I've discovered that the notification occurs under some conditions but not others. e.g. if you like a band from that band's page there will be a notification sent. If you edit your music likes from your "edit profile" page there will not be a notification sent. So this sounds like a bug.

回答1:

Not exactly the answer, but still ...

Couple of months ago i was given a task to fix a facebook app. It used information provided by facebook to build statistics. But policies changed and facebook stopped providing that info.

I've used graph and fql to obtain that information. Grahp api is pleasant, because you don't have to be registered + the answer is in json format. The main problem is that Graph api is soooooo slow....

Let me give you a hint that helped me: fql is very alike sql, and maybe you should try some functions or other methods which are native to sql.

Who knows!