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.
You would either need to do that query periodically, or use an XMPP (Jabber) connection to get updates in real-time.
来源:https://stackoverflow.com/questions/5295829/facebook-api-real-time-friends-online-presence-update