HTML and CSS Reference
In-Depth Information
Adding the Pusher API Credentials to the Config File
Now that you have the API credentials, they need to be included in the app. To do this, add three new constants—
shown in bold—to system/config/config.inc.php :
//-----------------------------------------------------------------------------
// Database credentials
//-----------------------------------------------------------------------------
$_C['DB_HOST'] = 'localhost';
$_C['DB_NAME'] = 'rwa_app';
$_C['DB_USER'] = 'root';
$_C['DB_PASS'] = '';
//-----------------------------------------------------------------------------
// Pusher credentials
//-----------------------------------------------------------------------------
$_C['PUSHER_KEY'] = '9570a71016cf9861a52b';
$_C['PUSHER_SECRET'] = '65cc09ede8e2c18701cc';
$_C['PUSHER_APPID'] = '37506';
//-----------------------------------------------------------------------------
// Enable debug mode (strict error reporting)
//-----------------------------------------------------------------------------
$_C['DEBUG'] = TRUE;
Downloading the PHP API Wrapper for Pusher
For the back-end portion of the app, we need to use an API wrapper to make accessing Pusher a breeze.
Download the API wrapper from https://github.com/pusher/pusher-php-server . The ZIP will contain
several files and directories, but the only one you need to grab is at lib/Pusher.php , which you should now copy to
system/lib/ in your app.
Including the PHP API Wrapper in the App
Now that the Pusher API wrapper is in the app's directory structure, it needs to be included for use. In index.php ,
add the following bold code to the initialization block:
// Starts the session
if (!isset($_SESSION)) {
session_start();
}
// Loads the configuration variables
require_once SYS_PATH . '/config/config.inc.php';
 
Search WWH ::




Custom Search