diff --git a/src/php/ajaxDemo/socket.php b/src/php/ajaxDemo/socket.php index 6151d398..b05c108c 100644 --- a/src/php/ajaxDemo/socket.php +++ b/src/php/ajaxDemo/socket.php @@ -80,6 +80,10 @@ function onGetImage($mynumber, $from, $id, $type, $t, $name, $size, $url, $file, $username = "************"; $password = "******************************"; $w = new WhatsProt($username, 0, "WhatsApi AJAX Demo", true); + +$w->eventManager()->bind("onGetImage", "onGetImage"); +$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture"); + $w->connect(); $w->loginWithPassword($password); @@ -87,12 +91,10 @@ function onGetImage($mynumber, $from, $id, $type, $t, $name, $size, $url, $file, if ($initial == "true" && $target != null) { //request contact picture only on first call $w->sendGetProfilePicture($target); - //finally starting to use the event manager! - $w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture"); } -$w->eventManager()->bind("onGetImage", "onGetImage"); + //subscribe contact status -//$w->SendPresenceSubscription($target); +$w->SendPresenceSubscription($target); //TODO: presense handling (online/offline/typing/last seen) while (running($time)) {