On this page
AblyBroadcaster
class AblyBroadcaster extends Broadcaster (View source)
Properties
protected Closure|null | $authenticatedUserCallback | The callback to resolve the authenticated user information. |
from Broadcaster |
protected array | $channels | The registered channel authenticators. |
from Broadcaster |
protected array | $channelOptions | The registered channel options. |
from Broadcaster |
protected BindingRegistrar | $bindingRegistrar | The binding registrar instance. |
from Broadcaster |
protected AblyRest | $ably | The AblyRest SDK instance. |
Methods
array|null | resolveAuthenticatedUser(Request $request) Resolve the authenticated user payload for the incoming connection request. |
from Broadcaster |
void | resolveAuthenticatedUserUsing(Closure $callback) Register the user retrieval callback used to authenticate connections. |
from Broadcaster |
$this | channel(HasBroadcastChannel|string $channel, callable|string $callback, array $options = []) Register a channel authenticator. |
from Broadcaster |
mixed | verifyUserCanAccessChannel(Request $request, string $channel) Authenticate the incoming request for a given channel. |
from Broadcaster |
array | extractAuthParameters(string $pattern, string $channel, callable|string $callback) Extract the parameters from the given pattern and channel. |
from Broadcaster |
ReflectionParameter[] | extractParameters(callable|string $callback) Extracts the parameters out of what the user passed to handle the channel authentication. |
from Broadcaster |
ReflectionParameter[] | extractParametersFromClass(string $callback) Extracts the parameters out of a class channel's "join" method. |
from Broadcaster |
array | extractChannelKeys(string $pattern, string $channel) Extract the channel keys from the incoming channel name. |
from Broadcaster |
mixed | resolveBinding(string $key, string $value, array $callbackParameters) Resolve the given parameter binding. |
from Broadcaster |
mixed | resolveExplicitBindingIfPossible(string $key, mixed $value) Resolve an explicit parameter binding if applicable. |
from Broadcaster |
mixed | resolveImplicitBindingIfPossible(string $key, mixed $value, array $callbackParameters) Resolve an implicit parameter binding if applicable. |
from Broadcaster |
bool | isImplicitlyBindable(string $key, ReflectionParameter $parameter) Determine if a given key and parameter is implicitly bindable. |
from Broadcaster |
array | formatChannels(array $channels) Format the channel array into an array of strings. |
|
BindingRegistrar | binder() Get the model binding registrar instance. |
from Broadcaster |
callable | normalizeChannelHandlerToCallable(mixed $callback) Normalize the given callback into a callable. |
from Broadcaster |
mixed | retrieveUser(Request $request, string $channel) Retrieve the authenticated user using the configured guard (if any). |
from Broadcaster |
array | retrieveChannelOptions(string $channel) Retrieve options for a certain channel. |
from Broadcaster |
bool | channelNameMatchesPattern(string $channel, string $pattern) Check if the channel name from the request matches a pattern from registered channels. |
from Broadcaster |
Collection | getChannels() Get all of the registered channels. |
from Broadcaster |
void | __construct(AblyRest $ably) Create a new broadcaster instance. |
|
mixed | auth(Request $request) Authenticate the incoming request for a given channel. |
|
mixed | validAuthenticationResponse(Request $request, mixed $result) Return the valid authentication response. |
|
string | generateAblySignature(string $channelName, string $socketId, array|null $userData = null) Generate the signature needed for Ably authentication headers. |
|
void | broadcast(array $channels, string $event, array $payload = []) Broadcast the given event. |
|
Message | buildAblyMessage(string $event, array $payload = []) Build an Ably message object for broadcasting. |
|
bool | isGuardedChannel(string $channel) Return true if the channel is protected by authentication. |
|
string | normalizeChannelName(string $channel) Remove prefix from channel name. |
|
mixed | getPublicToken() Get the public token value from the Ably key. |
|
mixed | getPrivateToken() Get the private token value from the Ably key. |
|
AblyRest | getAbly() Get the underlying Ably SDK instance. |
Details
array|null resolveAuthenticatedUser(Request $request)
Resolve the authenticated user payload for the incoming connection request.
See: https://pusher.com/docs/channels/library_auth_reference/auth-signatures/#user-authentication.
void resolveAuthenticatedUserUsing(Closure $callback)
Register the user retrieval callback used to authenticate connections.
See: https://pusher.com/docs/channels/library_auth_reference/auth-signatures/#user-authentication.
$this channel(HasBroadcastChannel|string $channel, callable|string $callback, array $options = [])
Register a channel authenticator.
protected mixed verifyUserCanAccessChannel(Request $request, string $channel)
Authenticate the incoming request for a given channel.
protected array extractAuthParameters(string $pattern, string $channel, callable|string $callback)
Extract the parameters from the given pattern and channel.
protected ReflectionParameter[] extractParameters(callable|string $callback)
Extracts the parameters out of what the user passed to handle the channel authentication.
protected ReflectionParameter[] extractParametersFromClass(string $callback)
Extracts the parameters out of a class channel's "join" method.
protected array extractChannelKeys(string $pattern, string $channel)
Extract the channel keys from the incoming channel name.
protected mixed resolveBinding(string $key, string $value, array $callbackParameters)
Resolve the given parameter binding.
protected mixed resolveExplicitBindingIfPossible(string $key, mixed $value)
Resolve an explicit parameter binding if applicable.
protected mixed resolveImplicitBindingIfPossible(string $key, mixed $value, array $callbackParameters)
Resolve an implicit parameter binding if applicable.
protected bool isImplicitlyBindable(string $key, ReflectionParameter $parameter)
Determine if a given key and parameter is implicitly bindable.
protected array formatChannels(array $channels)
Format the channel array into an array of strings.
protected BindingRegistrar binder()
Get the model binding registrar instance.
protected callable normalizeChannelHandlerToCallable(mixed $callback)
Normalize the given callback into a callable.
protected mixed retrieveUser(Request $request, string $channel)
Retrieve the authenticated user using the configured guard (if any).
protected array retrieveChannelOptions(string $channel)
Retrieve options for a certain channel.
protected bool channelNameMatchesPattern(string $channel, string $pattern)
Check if the channel name from the request matches a pattern from registered channels.
Collection getChannels()
Get all of the registered channels.
void __construct(AblyRest $ably)
Create a new broadcaster instance.
mixed auth(Request $request)
Authenticate the incoming request for a given channel.
mixed validAuthenticationResponse(Request $request, mixed $result)
Return the valid authentication response.
string generateAblySignature(string $channelName, string $socketId, array|null $userData = null)
Generate the signature needed for Ably authentication headers.
void broadcast(array $channels, string $event, array $payload = [])
Broadcast the given event.
protected Message buildAblyMessage(string $event, array $payload = [])
Build an Ably message object for broadcasting.
bool isGuardedChannel(string $channel)
Return true if the channel is protected by authentication.
string normalizeChannelName(string $channel)
Remove prefix from channel name.
protected mixed getPublicToken()
Get the public token value from the Ably key.
protected mixed getPrivateToken()
Get the private token value from the Ably key.
AblyRest getAbly()
Get the underlying Ably SDK instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Broadcasting/Broadcasters/AblyBroadcaster.html