Broadcaster
abstract class Broadcaster implements Broadcaster
Properties
| protected Container | $container | The container instance. |
|
| protected Closure|null | $authenticatedUserCallback | The callback to resolve the authenticated user information. |
|
| static protected array | $channels | The registered channel authenticators. |
|
| static protected array | $channelOptions | The registered channel options. |
|
| static protected Closure|null | $channelFormatter | The callback used to format outgoing channel values. |
|
| static protected null|Request, string): ?string | $channelAuthorizer | The callback used to authorize incoming channel names. |
|
| protected BindingRegistrar|null | $bindingRegistrar | The binding registrar instance. |
Methods
Resolve the authenticated user payload for the incoming connection request.
Register the user retrieval callback used to authenticate connections.
Register a channel authenticator.
Get the registered outgoing channel formatter.
Authenticate the incoming request for a given channel.
Return the valid authentication response for the authorized channel.
Extract the parameters from the given pattern and channel.
Extract the parameters out of what the user passed to handle the channel authentication.
Extract the parameters out of a class channel's "join" method.
Extract the channel keys from the incoming channel name.
Resolve the given parameter binding.
Resolve an explicit parameter binding if applicable.
Resolve an implicit parameter binding if applicable.
Determine if a given key and parameter is implicitly bindable.
Format the channel array into an array of strings.
Get the model binding registrar instance.
Normalize the given callback into a callable.
Retrieve the authenticated user using the configured guard (if any).
Retrieve options for a certain channel.
Check if the channel name from the request matches a pattern from registered channels.
Get all of the registered channels.
Flush all static state.
Details
at line 69
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.
at line 86
void
resolveAuthenticatedUserUsing(Closure|null $callback)
Register the user retrieval callback used to authenticate connections.
The callback persists in instance state on the cached broadcaster for the worker lifetime; per-request use races across coroutines.
See: https://pusher.com/docs/channels/library_auth_reference/auth-signatures/#user-authentication.
at line 101
Broadcaster
channel(HasBroadcastChannel|string $channel, callable|string $callback, array $options = [])
Register a channel authenticator.
The channel authorizer and options persist in shared static state on the Broadcaster class for the worker lifetime and apply to every subsequent connection authentication.
at line 123
static void
formatChannelsUsing(Closure|null $callback)
Register the outgoing channel formatter.
The callback persists in shared static state for the worker lifetime and applies to every broadcaster across all coroutines.
at line 132
static Closure|null
channelFormatter()
Get the registered outgoing channel formatter.
at line 143
static void
authorizeChannelsUsing(Closure|null $callback)
Register the incoming channel authorizer.
The callback persists in shared static state for the worker lifetime and applies to every broadcaster across all coroutines.
at line 154
protected mixed
verifyUserCanAccessChannel(Request $request, string $channel, bool $guarded = false)
Authenticate the incoming request for a given channel.
at line 193
protected mixed
validAuthenticationResponseForChannel(Request $request, mixed $result, string $channel)
Return the valid authentication response for the authorized channel.
at line 204
protected array
extractAuthParameters(string $pattern, string $channel, callable|string $callback)
Extract the parameters from the given pattern and channel.
at line 222
protected array
extractParameters(callable|string $callback)
Extract the parameters out of what the user passed to handle the channel authentication.
at line 238
protected array
extractParametersFromClass(string $callback)
Extract the parameters out of a class channel's "join" method.
at line 252
protected array
extractChannelKeys(string $pattern, string $channel)
Extract the channel keys from the incoming channel name.
at line 262
protected mixed
resolveBinding(string $key, string $value, array $callbackParameters)
Resolve the given parameter binding.
at line 276
protected mixed
resolveExplicitBindingIfPossible(string $key, mixed $value)
Resolve an explicit parameter binding if applicable.
at line 292
protected mixed
resolveImplicitBindingIfPossible(string $key, string $value, array $callbackParameters)
Resolve an implicit parameter binding if applicable.
at line 314
protected bool
isImplicitlyBindable(string $key, ReflectionParameter $parameter)
Determine if a given key and parameter is implicitly bindable.
at line 323
protected array
formatChannels(array $channels)
Format the channel array into an array of strings.
at line 338
protected BindingRegistrar|null
binder()
Get the model binding registrar instance.
at line 352
protected callable
normalizeChannelHandlerToCallable(callable|string $callback)
Normalize the given callback into a callable.
at line 362
protected mixed
retrieveUser(Request $request, string $channel)
Retrieve the authenticated user using the configured guard (if any).
at line 384
protected array
retrieveChannelOptions(string $channel)
Retrieve options for a certain channel.
at line 400
protected bool
channelNameMatchesPattern(string $channel, string $pattern)
Check if the channel name from the request matches a pattern from registered channels.
at line 410
Collection
getChannels()
Get all of the registered channels.
at line 418
static void
flushState()
Flush all static state.