Skip to content

Instantly share code, notes, and snippets.

@MrAtiebatie
Last active May 2, 2018 09:20
Show Gist options
  • Save MrAtiebatie/9765dd2d8757d72969ce6cdfba234d64 to your computer and use it in GitHub Desktop.
Save MrAtiebatie/9765dd2d8757d72969ce6cdfba234d64 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers\Api;
use Pusher\Pusher;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class BroadcastAuthController extends Controller
{
/**
* Authenticate
* @param Request $request
* @return Response
*/
public function auth(Request $request)
{
$pusher = new Pusher(
config('broadcasting.connections.pusher.key'),
config('broadcasting.connections.pusher.secret'),
config('broadcasting.connections.pusher.app_id'),
config('broadcasting.connections.pusher.options')
);
return $pusher->socket_auth($request->channel_name, $request->socket_id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment