-
Notifications
You must be signed in to change notification settings - Fork 2
TopicAPI
fkmhrk edited this page Sep 24, 2013
·
3 revisions
require_once ('<library_root>'. '/src/kii/KiiAppAPI.php');
$context = new KiiContext(APP_ID, APP_KEY, SITE);
$appPpi = new KiiAppAPI($context);
$api = $appApi->topicAPI();
$userId = 'user1234';
$topicName = 'test';
$topic = new KiiTopic(new KiiUser($userId), $topicName);
try {
$topicApi->create($topic);
} catch (CloudException $e) {
//error handling
}
$topicName = 'test';
$topic = new KiiTopic($group, $topicName);
$message = new KiiTopicMessage();
$message->data['msg'] = 'hello';
try {
$topicApi->sendMessage($topic, $message);
} catch (CloudException $e) {
//error handling
}