Facebook API 实时好友在线状态更新 [英] Facebook API real-time friends' online presence update

查看:31
本文介绍了Facebook API 实时好友在线状态更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在 facebook 上开发一个应用程序,其中包含我的朋友列表并显示他们的在线状态.为了得到这个,我使用了:

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?

请帮忙.谢谢.

推荐答案

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

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

这篇关于Facebook API 实时好友在线状态更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆