Facebook API 实时好友在线状态更新
我目前正在 Facebook 上开发一个应用程序,其中包含我的朋友列表并显示他们的在线状态。为了实现这一点,我使用了:
$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
));
但由于我仅在打开应用程序时获取此信息(状态、在线状态),因此在重新加载应用程序之前它不会改变。
我的问题是,我如何才能实时更新我的朋友的状态更改或在线状态更改?
请帮忙。谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要定期执行该查询,或者使用 XMPP (Jabber) 连接来实时获取更新。
You would either need to do that query periodically, or use an XMPP (Jabber) connection to get updates in real-time.