简体   繁体   English

如何使用Facebook API使用FQL获取在线好友列表?

[英]How to get list of online friends using FQL with facebook API?

I have got my friends list after getting logging in on facebook using Facebook connect Java script client API. 在使用Facebook连接Java脚本客户端API登录Facebook后,我收到了我的好友列表。 I want list of my friends that are online at given time. 我想要在给定时间在线的朋友列表。

You can use the online_presence column of the user table, which gives the user's current Facebook Chat status. 您可以使用user表的online_presence列,该列提供用户当前的Facebook聊天状态。 This isn't a foolproof "is this user online right now" but it does serve the general purpose as such. 这不是一个万无一失的“这个用户现在在线”,但它确实可以满足一般用途。 This column is a string which has one of four possible values: active , idle , offline , or error . 此列是一个字符串,它具有四个可能值之一: activeidleofflineerror Querying the friend table in conjunction with this can yield the result you requested (in this case I consider "online" to mean active or idle ): 与此一起查询friend表可以产生您请求的结果(在这种情况下,我认为“在线”表示activeidle ):

SELECT uid FROM user WHERE
  online_presence IN ('active', 'idle')
  AND uid IN (
    SELECT uid2 FROM friend WHERE uid1 = $user_id
  )

UPDATE: 更新:

Note that you need the user_status permission to read the user's status and user_online_presence and/or friends_online_presence permissions for the online_presence . 请注意,您所需要的user_status权限读取用户的状态和user_online_presence和/或friends_online_presence权限的online_presence

Thanks to https://stackoverflow.com/users/613631/laphroaig for bringing this up ( Facebook online friend ), and to https://stackoverflow.com/users/570958/roozbeh15 for his answer. 感谢https://stackoverflow.com/users/613631/laphroaig提出这个问题( Facebook在线朋友 ),并通过https://stackoverflow.com/users/570958/roozbeh15获取答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM