0

I'm currently developing an app in facebook which has a list of my friends and shows their online presence. To get this, I used:

$fql = "SELECT uid, name, online_presence, status FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = '".$this->user_id."')";
$active = $this->facebook->api(array(
  'method' => 'fql.query',
  'query' =>$fql
));

But since I'm only getting this information (status, online presence) at the time when I open my app, it'll not change until I reload my app.

My question is, how can I get a real-time update of status-change or online-presence change by my friends?

Please help. Thanks.

Majinbibo
  • 159
  • 5
  • 17

1 Answers1

0

You would either need to do that query periodically, or use an XMPP (Jabber) connection to get updates in real-time.

Brian Roach
  • 76,169
  • 12
  • 136
  • 161
  • Well, yeah. You either have to keep checking, or hook into XMPP and have the updates sent to you. – Brian Roach Mar 14 '11 at 08:08
  • What about the [`friends_online_presence`](https://developers.facebook.com/docs/authentication/permissions/) permission? – a paid nerd Aug 09 '12 at 18:31
  • Please note, XMPP is going to be removed from Facebook in 2015. – Dave Chen Sep 06 '14 at 07:52
  • @BrianRoach Per my question here (http://stackoverflow.com/questions/27222641/fetch-online-presence-for-thousands-of-facebook-app-users) I heard from Facebook directly that you can't currently subscribe to online_presence and they have no plans to make that possible. Do you think there's a different way to use XMPP to get this info? – user1544138 Dec 14 '14 at 02:34