Pusher - Private channel subscription

user2842722 picture user2842722 · May 26, 2014 · Viewed 8.3k times · Source

I have a code with subscribe private channels, and when I try make a subscription I have the next message:

Pusher : Couldn't get auth info from your webapp : 404

Scenario:

Javascript(Sencha touch) and PHP(Laravel)

The subscription is in javascript:

    Pusher.channel_auth_endpoint = "/pusher.php";

    var APP_KEY = '4324523452435234523';
    var pusher = new Pusher(APP_KEY);
    var channel = pusher.subscribe('private-l2');
    channel.bind('pusher:subscription_succeeded', function() {
      alert("ahora siiii");
    });

    // for debugging purposes. Not required.
    Pusher.log = function(msg) {
      if(window.console && window.console.log) {
        window.console.log("PUSHER LOG: "+msg);
      }  
    }

AND the pusher.php / LARAVEL

    $this->app_id = '66981';
    $this->app_key = '4324523452435234523';
    $this->app_secret = 'f34632459911e2670dcf';

   $pusher = new Pusher($this->app_key, $this->app_secret, $this->app_id);
    $auth    = $pusher->socket_auth(Input::get('channel_name'), Input::get('socket_id'));

    echo $auth;

The result is the error:

     Pusher : State changed : connecting -> connected
     Pusher : Couldn't get auth info from your webapp : 404 

Answer

Daryl Spitzer picture Daryl Spitzer · Jun 24, 2014

Private Pusher channels require the client to authenticate for access. See http://pusher.com/docs/authenticating_users for details on configuring the client for authentication and setting up an authentication endpoint.