PHP code example of tanuck / pusher
1. Go to this page and download the library: Download tanuck/pusher library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tanuck / pusher example snippets
CakePlugin::load('CakePusher');
class MyController extends AppController {
public $components = array(
'CakePusher.Pusher' => array(
'auth_key' => 'PUSHER_APP_AUTH_KEY',
'secret' => 'PUSHER_APP_SECRET',
'app_id' => 'PUSHER_APP_ID',
),
);
}
$this->Pusher->trigger('my-channel', 'my-event', 'My Message');
class MyController extends AppController {
public $components = array(
'CakePusher.Pusher' => array(
'main' => array(
'auth_key' => 'PUSHER_APP_AUTH_KEY',
'secret' => 'PUSHER_APP_SECRET',
'app_id' => 'PUSHER_APP_ID',
),
'otherApp' => array(
'auth_key' => 'PUSHER_APP_AUTH_KEY',
'secret' => 'PUSHER_APP_SECRET',
'app_id' => 'PUSHER_APP_ID',
),
),
);
}
$this->Pusher->trigger('my-channel', 'my-event', 'My Message');
$this->Pusher->socketAuth('my-channel', '1234.1234');
$this->Pusher->presenceAuth('my-channel', '1234.1234', 'user-12', true);
$this->Pusher->get('/channels');
$this->Pusher->with('otherApp')->trigger('my-channel', 'my-event', 'My Message');
$this->Pusher->getDefault();
$this->Pusher->setDefault('otherApp');
$this->Pusher->addAppConfig('myAppName', array(
'auth_key' => 'PUSHER_APP_AUTH_KEY',
'secret' => 'PUSHER_APP_SECRET',
'app_id' => 'PUSHER_APP_ID',
));