当前位置: 首页>>代码示例>>PHP>>正文


PHP Pusher类代码示例

本文整理汇总了PHP中Pusher的典型用法代码示例。如果您正苦于以下问题:PHP Pusher类的具体用法?PHP Pusher怎么用?PHP Pusher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Pusher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleted

 public function deleted($clientId, $entity, $pkArray)
 {
     $channels = $this->dbClass->removeFromRegisterd($clientId, $entity, $pkArray);
     $this->loadPusher();
     $pusher = new Pusher($this->dbSettings->pusherKey, $this->dbSettings->pusherSecret, $this->dbSettings->pusherAppId);
     $data = array('entity' => $entity, 'pkvalue' => $pkArray);
     $response = $pusher->trigger($channels, 'delete', $data);
 }
开发者ID:haya-sann,项目名称:INTER-Mediator,代码行数:8,代码来源:NotifyServer.php

示例2: testCanSubscribeMemberToPusherChannel

 /**
  * Test that a user can subscribe to a pusher channel
  *
  * @return void
  */
 public function testCanSubscribeMemberToPusherChannel()
 {
     $this->request->shouldReceive('input')->times(3)->andReturn('foo');
     $this->pusher->shouldReceive('presence_auth')->once()->with('foo', 'foo', m::type('string'), ['username' => 'foo']);
     $this->call('POST', 'pusher/auth');
     $this->assertResponseOk();
 }
开发者ID:jahvi,项目名称:chatty,代码行数:12,代码来源:PusherAuthTest.php

示例3: sendMessage

 /**
  *
  * @param $message
  * @param $channel
  * @return bool|string
  * @author Christophe Nick
  */
 public function sendMessage($message, $channel = "babel95")
 {
     date_default_timezone_set('UTC');
     $pusher = new \Pusher($this->appKey, $this->appSecret, $this->appID);
     $response = $pusher->trigger($channel, 'chat_message', $message['data'], null, true);
     return $response;
 }
开发者ID:RyuX51,项目名称:BABEL95,代码行数:14,代码来源:MessageSender.php

示例4: testSchemeIsStrippedAndIgnoredFromHostInOptions

 public function testSchemeIsStrippedAndIgnoredFromHostInOptions()
 {
     $options = array('host' => 'https://test.com');
     $pusher = new Pusher('app_key', 'app_secret', 'app_id', $options);
     $settings = $pusher->getSettings();
     $this->assertEquals('http', $settings['scheme']);
     $this->assertEquals('test.com', $settings['host']);
 }
开发者ID:jwwk-de,项目名称:pusher-http-php,代码行数:8,代码来源:pusherConstructorTest.php

示例5: newNotification

 public function newNotification()
 {
     $post = $this->input->post();
     $channel = $post['action'];
     $message = $post['msg'];
     $type = $post['type'];
     $pusher = new Pusher($key, $secret, $app_id, $debug, $host, $port, $timeout);
     $pusher->trigger($channel, $type, array('message' => $message));
 }
开发者ID:brandon-bailey,项目名称:osdms,代码行数:9,代码来源:Notifications.php

示例6: broadcast

 /**
  * Broadcast the given event.
  *
  * @param  array  $channels
  * @param  string  $event
  * @param  array  $payload
  * @return void
  */
 public function broadcast(array $channels, $event, array $payload = [])
 {
     $socket = Arr::pull($payload, 'socket');
     $response = $this->pusher->trigger($this->formatChannels($channels), $event, $payload, $socket);
     if (is_array($response) && $response['status'] >= 200 && $response['status'] <= 299 || $response === true) {
         return;
     }
     throw new BroadcastException(is_bool($response) ? 'Failed to connect to Pusher.' : $response['body']);
 }
开发者ID:bryanashley,项目名称:framework,代码行数:17,代码来源:PusherBroadcaster.php

示例7: testEncryptedPush

 public function testEncryptedPush()
 {
     $options = array('encrypted' => true, 'host' => PUSHERAPP_HOST);
     $pusher = new Pusher(PUSHERAPP_AUTHKEY, PUSHERAPP_SECRET, PUSHERAPP_APPID, $options);
     $pusher->set_logger(new TestLogger());
     $batch = array();
     $batch[] = array('channel' => 'test_channel', 'name' => 'my_event', 'data' => array('my' => 'data'));
     $string_trigger = $this->pusher->triggerBatch($batch);
     $this->assertTrue($string_trigger, 'Trigger with string payload');
 }
开发者ID:Arch1js,项目名称:Westcombe-Engineering-MRP-system,代码行数:10,代码来源:triggerBatchTest.php

示例8: it_dump_composer_json_content_to_file

 public function it_dump_composer_json_content_to_file(ConsumerEvent $event, Message $message, \Pusher $pusher, Filesystem $filesystem)
 {
     $event->getMessage()->shouldBeCalled()->willReturn($message);
     $message->getValue('channelName')->shouldBeCalled()->willReturn('new_channel');
     $message->getValue('body')->shouldBeCalled()->willReturn('composer.json content');
     $pusher->trigger('new_channel', 'consumer:new-step', array('message' => 'Starting async job'))->shouldBeCalled();
     $filesystem->mkdir(sys_get_temp_dir() . '/' . 'composer_dir')->shouldBeCalled();
     $filesystem->dumpFile(sys_get_temp_dir() . '/composer_dir/composer.json', 'composer.json content')->shouldBeCalled();
     $this->execute($event, 'composer_dir')->shouldReturn(0);
 }
开发者ID:pborreli,项目名称:composer-service,代码行数:10,代码来源:DumpFileStepSpec.php

示例9: ready

 public function ready()
 {
     $data['aula'] = $this->input->get('aula');
     $data['piso'] = $this->input->get('piso');
     $app_id = '163670';
     $app_key = '6abac2ed749f4430d6f6';
     $app_secret = '86ce372daf8832b6df67';
     $pusher = new Pusher($app_key, $app_secret, $app_id);
     $data['message'] = 'El inconveniente ha sido solucionado en el AULA : ' . $data['aula'] . " PISO : " . $data['piso'];
     $pusher->trigger('rtc1', 'ok', $data);
 }
开发者ID:NicolasMontoya,项目名称:SARA,代码行数:11,代码来源:Embedded.php

示例10: push

function push($secure, $article)
{
    $pusher = new Pusher($secure['pusher_key'], $secure['pusher_secret'], $secure['pusher_id'], array('encrypted' => true));
    $push = [];
    $push['pub_time'] = $article->pub_time;
    $push['title'] = $article->title;
    $push['content'] = $article->content;
    $push['link'] = $article->link;
    $push['author'] = $article->author;
    return $pusher->trigger('notablenews', 'newnews', $push);
}
开发者ID:GregBrimble,项目名称:notablenews,代码行数:11,代码来源:update.php

示例11: it_push_error_message_and_alerts_when_vulnerability_found

 function it_push_error_message_and_alerts_when_vulnerability_found(SecurityChecker $securityChecker, ConsumerEvent $event, Message $message, \Pusher $pusher)
 {
     $event->getMessage()->shouldBeCalled()->willReturn($message);
     $message->getValue('channelName')->shouldBeCalled()->willReturn('new_channel');
     $pusher->trigger('new_channel', 'consumer:new-step', array('message' => 'Checking vulnerability'))->shouldBeCalled();
     $securityChecker->check(sys_get_temp_dir() . '/composer_dir/composer.lock', 'text')->shouldBeCalled()->willReturn($this->getVulnerabilityMessage());
     $securityChecker->getLastVulnerabilityCount()->shouldBeCalled()->willReturn(1);
     $pusher->trigger('new_channel', 'consumer:step-error', array('message' => 'Vulnerability found : 1'))->shouldBeCalled();
     $pusher->trigger('new_channel', 'consumer:vulnerabilities', array('message' => $this->getVulnerabilityMessage()))->shouldBeCalled();
     $this->execute($event, 'composer_dir')->shouldReturn(0);
 }
开发者ID:Omranic,项目名称:composer-service,代码行数:11,代码来源:CheckVulnerabilitiesStepSpec.php

示例12: pushToUser

function pushToUser($user_id, $title, $message, $type, $typedata, $con)
{
    //get api key from https://code.google.com/apis/console/
    if (checkSettings($user_id, $type, $con)) {
        $regIds = getDeviceIdByUserId($user_id, $con);
        foreach ($regIds as $i => $regId) {
            $pusher = new Pusher();
            $pusher->notify($regId, $message, $title, $type, $typedata);
            pushLog($pusher->getOutputAsArray(), $con, $title, $message, $type, $typedata, $user_id, $regId);
        }
    }
}
开发者ID:joyfulful,项目名称:DogBloodDonor_Web,代码行数:12,代码来源:push_functions.inc.php

示例13: _callback

function _callback($status)
{
    $pusher = new Pusher(PUSHER_KEY, PUSHER_SECRET, PUSHER_APP_ID);
    $id_str = $status['id_str'];
    $text = $status['text'];
    //	$id = $status['user']['id'];
    $screen_name = $status['user']['screen_name'];
    $name = $status['user']['name'];
    $profile_image_url = $status['user']['profile_image_url'];
    $json = array("data" => array("id_str" => $id_str, "text" => $text, "user" => array("name" => $name, "screen_name" => $screen_name, "profile_image_url" => $profile_image_url)));
    if ($id_str != "") {
        $pusher->trigger(PUSHER_CHANNEL_NAME, PUSHER_EVENT_NAME, $json);
    }
    //	echo $status['user']['name'].':'.$status['text'] . PHP_EOL;
    return true;
}
开发者ID:hiiro,项目名称:twStreamViewer,代码行数:16,代码来源:streaming.php

示例14: handle_form_submission

 /**
  * Handles form submissions
  *
  * @param   $action string  The form action being performed
  * @return          void
  */
 protected function handle_form_submission($action)
 {
     if ($this->check_nonce()) {
         // Calls the method specified by the action
         $output = $this->{$this->actions[$action]}();
         if (is_array($output) && isset($output['room_id'])) {
             $room_id = $output['room_id'];
         } else {
             throw new Exception('Form submission failed.');
         }
         // Realtime stuff happens here
         $pusher = new Pusher(PUSHER_KEY, PUSHER_SECRET, PUSHER_APPID);
         $channel = 'room_' . $room_id;
         $pusher->trigger($channel, $action, $output);
         header('Location: ' . APP_URI . 'room/' . $room_id);
         exit;
     } else {
         throw new Exception('Invalid nonce.');
     }
 }
开发者ID:kai-cn,项目名称:bookcode-realtimewebapps,代码行数:26,代码来源:class.controller.inc.php

示例15: send_message

	function send_message($user_id,$to,$subject,$msg,$parent_id=NULL){
		if($parent_id==0)$parent_id=NULL;
		$doc = array(
			"from" => $user_id,
			"to" => $to,
			"title" => htmlentities($subject),
			"content" => $msg,
			"parent_id" => $parent_id,
		);
		$res = $this->db->insert('messages', $doc);
		//push new message
		require_once(getcwd()."/application/helpers/pusher/Pusher.php");
		$pusher = new Pusher('deb0d323940b00c093ee', '9ab20336af22c4e7fa77', '25755');
		$data = array(
			'from' => $user_id,
			'to' => $to,
			'message_id'=> $this->db->insert_id()
		);
		$pusher->trigger('message-'.$to, 'new-message', $data );
		return $res;
	}
开发者ID:raminv80,项目名称:CodeArmy,代码行数:21,代码来源:message_model.php


注:本文中的Pusher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。