The following shows an example of how you might publish a list of logged in users into Kwwika.
This example uses the example Kwwika REST Client. The source code for this can be found in github:
<?php require_once('kwwika_rest_client.php');
function get_online_users() { // loop through online users in application state return array('online_users' => '[{"name":"Phil"}, {"name": "Jim"}, {"name":"Dave"}]'); }
$online_users = get_online_users(); $api_key = 'YOUR_API_KEY'; $domain = 'YOUR_DOMAIN'; $topic_path = 'PATH_TO_YOUR_USERINFO_TOPIC'; $result = kwwika_rest_client($api_key, $domain, $topic_path, $online_users);
print_r($result); ?>
|