Broadcaster.php
TLDR
This file Broadcaster.php
defines an interface Broadcaster
which contains three methods: auth
, validAuthenticationResponse
, and broadcast
. These methods are used for broadcasting events in Laravel.
Methods
auth
This method is used to authenticate an incoming request for a given channel. It takes an instance of Request
as a parameter and returns a response.
validAuthenticationResponse
This method is used to return a valid authentication response. It takes an instance of Request
and a result parameter and returns a response.
broadcast
This method is used to broadcast a given event to multiple channels. It takes an array of channels, a string representing the event, and an optional array of payload. It does not return any value but throws a BroadcastException
if there is an error during broadcasting.
<?php
namespace Illuminate\Contracts\Broadcasting;
interface Broadcaster
{
/**
* Authenticate the incoming request for a given channel.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function auth($request);
/**
* Return the valid authentication response.
*
* @param \Illuminate\Http\Request $request
* @param mixed $result
* @return mixed
*/
public function validAuthenticationResponse($request, $result);
/**
* Broadcast the given event.
*
* @param array $channels
* @param string $event
* @param array $payload
* @return void
*
* @throws \Illuminate\Broadcasting\BroadcastException
*/
public function broadcast(array $channels, $event, array $payload = []);
}