Advertisement
arkader

Pusher Endpoint code sample

May 26th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2.  
  3.     session_start();
  4.     header('Content-Type: application/json');
  5.     require_once('pusher_info.php');
  6.    
  7.     if(!isset($_SESSION['user_id']))
  8.     {
  9.         $_SESSION['user_id'] = time();
  10.     }
  11.     $channel_name = $_POST['channel_name'];
  12.    
  13.     // check user has access to $channel_name
  14.     echo $_pusher->presence_auth($channel_name, $_POST['socket_id'], $_SESSION['user_id'], array('id' => $_SESSION['user_id']));
  15.    
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement