I have an app where I send xmpp message to some devices. This successfully works. But now I want to recieve roster (list of connected users) and I get empty array, however there are 4 users there. Here is my code
require_once($_SERVER["DOCUMENT_ROOT"]."/lib/xmpphp/XMPP.php");
$con=$conf->getXMPPObj();
try {
$con->useEncryption(false);
$con->connect();
$con->processUntil('session_start');
$con->presence();
$roster=$con->roster->getRoster();
var_dump($roster);
//$con->processUntil('roster_received');
if (strpos($_POST['msg'],'CamMode')!==false)
{
$con->message("user@host" ,$_POST['msg']);
}
else
{
$con->message("user@host",$_POST['msg']);
}
$con->disconnect();
}
catch(XMPPHP_Exception $e)
{
die($e->getMessage());
}
messages are successfully sent but dump of $roster
is empty. What's wrong?