示例#1
0
文件: Pubnub.php 项目: njokipal/php
 /**
  * Set metadata for all channels in the group
  *
  * @param string $group
  * @param array|null $state
  * @param string|null $uuid
  *
  * @throws PubnubException
  *
  * @return mixed|null
  */
 public function setChannelGroupState($group, $state, $uuid = null)
 {
     if (empty($group)) {
         throw new PubnubException('Missing Group in setChannelGroupState()');
     }
     $uuid = $uuid ? $uuid : $this->SESSION_UUID;
     $state = PubnubUtil::url_encode(PubnubUtil::json_encode($state));
     return $this->request(array('v2', 'presence', 'sub_key', $this->SUBSCRIBE_KEY, 'channel', '.', 'uuid', PubnubUtil::url_encode($uuid), 'data'), array('state' => $state, 'channel-group' => PubnubUtil::url_encode($group)));
 }