pusherer
pusherer copied to clipboard
Auth and private channel
Is there anyway to auth a user with laravels Auth::check() and only send data to private channels?
I am also trying to do the same. Any ideas??
Nope no answer yet.
i don't know if you solved that problem, but the soluction is:
1 - Create PusherController
public function auth()
{
// make your logic to allow autentication
if (Input::has('channel_name') && Input::has('socket_id')) {
$socket = Pusherer::socket_auth(Input::get('channel_name'), Input::get('socket_id'));
return Response::make($socket);
}
return Response::make('Forbidden', 403);
}
2 - routes.php, you need create /pusher/auth
Route::post('/pusher/auth', array('as' => 'api.pusher', 'uses' => 'PusherController@auth'));
Done. Now whenever you subscribe to a channel with private prefix, you will consult this route to authenticate.