Facebook API 实时好友在线状态更新

发布于 2024-10-21 22:58:19 字数 444 浏览 5 评论 0原文

我目前正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

真心难拥有 2024-10-28 22:58:19

您需要定期执行该查询,或者使用 XMPP (Jabber) 连接来实时获取更新。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文