0

I subscribed here https://developers.facebook.com/apps/301135526661971/realtime?save=1 to real-time updates successfully 'test' was ok. my 'fields' are set to 'online_presence', 'friends','status','statuses' but Facebook never updates me!? here is my callback.php:

<html><head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="jquery-1-7-2.js"></script>
<style>
body{font-style:normal;font-size;12px/1.1em;font-family:"lucida grande",tahoma,verdana,arial,sans-serif;line-height:1.4em;font-size:62.5%;background-color:#FFFFFF;}
A.update:link {text-decoration:none;color:#DEE3ED;font-weight:bold;}
A.update:visited {text-decoration:none;color:#DEE3ED;font-weight:bold;}
A.update:active {text-decoration:none;color:#DEE3ED;font-weight:bold;}
A.update:hover {text-decoration:none;color:#FFF;font-weight:bold;}
.Bf{width:183px;height:34px;background-color:#FAFAFA;border-style:none;border-top-style:solid;border-top-width:1px;border-color:#D8DFEA;}
</style>

<script>
var NN = 0;
var Q; //FQL
var meid,me;//Qid is every one including me

window.fbAsyncInit = function(){
    FB.init({ appId:'0000000000',status:true,cookie:true,xfbml:true,oauth:true,hideFlashCallback:true});
    FB.getLoginStatus(function(response){
    if(response.status==='connected'){
        FB.api('/me',function(response){me=response.name;meid=response.id;getFriends();});
        }
    else{
        FB.login(function(response){if(response.authResponse){
        FB.api('/me',function(response){me=response.name;meid=response.id;getFriends();});
        }},{scope:'friends_online_presence,user_status,user_birthday,friends_birthday,publish_stream,user_photos,friends_photos'});
        }});};

var Pt1 = '<div class="Bf"value="';
var Pt2 = '"title="';
var Pt3 = '"><img width="30px"height="30px"style="margin:2px;"align="left"src="http://graph.facebook.com/';
var Pt4 = '/picture?type=square"/>';
var Pt0 = '<br><span id="BD"></span></div>';

function getFriends(){
    Q=FB.Data.query("SELECT name,uid,online_presence FROM user WHERE (online_presence=='active' OR online_presence=='idle') AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ORDER BY online_presence");
    Q.wait(function(rows){$.each(rows,function(index,f){
    //
    if(f.online_presence=='active'){    $('#non').append(Pt1+f.uid+Pt2+f.name+Pt3+f.uid+Pt4+'<a href="http://facebook.com/'+f.uid+'"target="_blank">'+f.name+'</a><br><img src="R/fbactive.png"></div>');}
    else if(f.online_presence=='idle'){ $('#non').append(Pt1+f.uid+Pt2+f.name+Pt3+f.uid+Pt4+'<a href="http://facebook.com/'+f.uid+'"target="_blank">'+f.name+'</a><br><img src="R/fbidle.png"></div>');}
    //
    $('.Bf').unbind().bind('hover',function(){$(this).css("background-color","#FFFFFF");},function(){$(this).css("background-color","#FAFAFA");}).bind('click',function(){});
    NN++;
    if(NN==rows.length){
            NN=0;$('#Flist').prepend('<img style="margin:2px;height:30px;"align="left"src="http://graph.facebook.com/'+meid+'/picture?type=square"/><b>'+me+'</b><br><br><br>');
            }});});}


</script>
</head><body>
<?php define('VERIFY_TOKEN','011235813');$method = $_SERVER['REQUEST_METHOD'];if($method=='GET' && $_GET['hub_mode']=='subscribe' && $_GET['hub_verify_token']==VERIFY_TOKEN) {echo $_GET['hub_challenge'];}else if($method=='POST'){$updates=json_decode(file_get_contents('php://input'),true);echo $updates;} ?>

<div id="fb-root"></div>


<div id="Flist"
     style="position:absolute;width:183px;left:0px;
     background-color:#F2F2F2;
     border-color:#D8DFEA;
     border-width:1px;
     border-style:solid;
     overflow:auto;
     overflow-x:hidden;">
    <div id="non"style="width:183px;"></div>
    <br>
</div>


<script type="text/javascript">
    /*END fbAsyncInit*/(function(){var e = document.createElement('script'); e.async = true;e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';document.getElementById('fb-root').appendChild(e);}());
</script>

</body></html>

All the code i have is here, im stumped as to why i hear nothing?

UPDATE!

i tried using only php:

<?php
require "facebook.php";
$facebook = new Facebook(array('appId'  => '000000','secret' => '0000',));
$user = $facebook->getUser();
if($user){
    try{
        $me = $facebook->api('/me');
        echo 'logged in';
        define('VERIFY_TOKEN','011235813');
        $method = $_SERVER['REQUEST_METHOD'];
        if($method=='GET' && $_GET['hub_mode']=='subscribe' && $_GET['hub_verify_token']==VERIFY_TOKEN) {echo $_GET['hub_challenge'];}
        else if($method=='POST'){$updates=json_decode(file_get_contents('php://input'),true);echo $updates;}
        }catch(FacebookApiException $e){$user=null;}
}
?>

but facebook still doesn't post to my callback...

Update: online_presence is provided by facebook

Ben Muircroft
  • 2,936
  • 8
  • 39
  • 66
  • Note that you can not subscribe to changes on all properties and connections of the User object. Connections to which you can subscribe include: feed, friends, activities, interests, music, books, movies, television, likes, checkins, location, events. – Ben Muircroft Oct 24 '12 at 20:59
  • so they only provide part of the user table hmm... well then i have no choice but to poll there severs every couple of seconds then! well done facebook! – Ben Muircroft Oct 24 '12 at 21:01
  • thinking about it i am wrong, or facebook is wrong! something is really wrong here... (see my image above) – Ben Muircroft Oct 25 '12 at 10:38

2 Answers2

0

online_presence is not available via real time updates, the possible fields are

  • feed
  • friends
  • activities
  • interests
  • music
  • books
  • movies
  • television
  • likes
  • checkins
  • location
  • events
phwd
  • 19,975
  • 5
  • 50
  • 78
0

If you want real-time updates for user status messages, you must enable 'feed' in the subscription (under "Fields").

Donn Lee
  • 2,962
  • 1
  • 24
  • 16