BroadcastManager
class BroadcastManager implements Factory mixin Broadcaster
Traits
Properties
| protected Closure> | $releaseCallbacks | from HasPoolProxy | |
| protected array | $drivers | The array of resolved broadcast drivers. |
|
| protected array | $customCreators | The registered custom driver creators. |
|
| protected array | $poolables | The array of drivers which will be wrapped as pool proxies. |
Methods
Create a pool proxy for an immutable definition.
Build a namespaced pool definition for a pooled resource.
Get the shared object-pool factory.
Get the release callback for a pooled driver.
Add a driver to the poolable-driver list.
Remove a driver from the poolable-driver list.
Get a configuration value from an attribute, falling back to a property.
Extract the value from an attribute instance.
Get an instance of the given attribute class from the target class or its parents.
Determine if a property declared on a child class overrides an inherited attribute.
Resolve the default connection name for a given queueable instance.
Resolve the default queue name for a given queueable instance.
Register the routes for handling broadcast channel authentication and sockets.
Register the routes for handling broadcast user authentication.
Register the routes for handling broadcast authentication and sockets.
Begin sending an anonymous broadcast to the given private channels.
Begin sending an anonymous broadcast to the given presence channels.
Begin broadcasting an event.
Queue the given event for broadcast.
Determine if the broadcastable event must be unique and determine if we can acquire the necessary lock.
Get a driver instance.
Get a driver instance.
Attempt to get the connection from the local cache.
Resolve the given broadcaster with Pool Proxy if need.
Resolve the given broadcaster.
Call a custom driver creator.
Create an instance of the driver.
Create an instance of the driver.
Get a Pusher instance for the given configuration.
Create an instance of the driver.
Get an Ably instance for the given configuration.
Create an instance of the driver.
Create an instance of the driver.
Create an instance of the driver.
Get the connection configuration.
Get the default driver name.
Set the default broadcast driver name.
Disconnect the given driver and close its shared resource pool.
Get the application instance used by the manager.
Forget all of the resolved driver instances.
Dynamically call the default driver instance.
Details
in
HasPoolProxy at line 24
protected mixed
createPoolProxy(string $driver, Closure $resolver, PoolDefinition $definition, string $proxyClass)
Create a pool proxy for an immutable definition.
in
HasPoolProxy at line 45
protected PoolDefinition
poolDefinition(string $resource, array $poolConfig, array $fingerprintSource)
Build a namespaced pool definition for a pooled resource.
at line 455
protected Factory
poolFactory()
Get the shared object-pool factory.
in
HasPoolProxy at line 71
HasPoolProxy
setReleaseCallback(string $driver, Closure $callback)
Set the release callback for a pooled driver.
Boot-only. The callback persists on the manager for the worker lifetime and is captured by every subsequently created proxy for the driver.
in
HasPoolProxy at line 81
Closure|null
getReleaseCallback(string $driver)
Get the release callback for a pooled driver.
in
HasPoolProxy at line 93
HasPoolProxy
addPoolable(string $driver)
Add a driver to the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
HasPoolProxy at line 109
HasPoolProxy
removePoolable(string $driver)
Remove a driver from the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
HasPoolProxy at line 126
array
getPoolables()
Get the poolable-driver list.
in
HasPoolProxy at line 138
HasPoolProxy
setPoolables(array $poolables)
Set the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
ReadsClassAttributes at line 15
protected mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)
Get a configuration value from an attribute, falling back to a property.
in
ReadsClassAttributes at line 44
protected mixed
extractAttributeValue(object $instance)
Extract the value from an attribute instance.
in
ReadsClassAttributes at line 54
protected object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)
Get an instance of the given attribute class from the target class or its parents.
in
ReadsClassAttributes at line 70
protected bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)
Determine if a property declared on a child class overrides an inherited attribute.
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
in
ResolvesQueueRoutes at line 15
string|null
resolveConnectionFromQueueRoute(object $queueable)
Resolve the default connection name for a given queueable instance.
in
ResolvesQueueRoutes at line 23
string|null
resolveQueueFromQueueRoute(object $queueable)
Resolve the default queue name for a given queueable instance.
in
ResolvesQueueRoutes at line 31
protected QueueRoutes
queueRoutes()
Get the queue routes manager instance.
at line 74
__construct(Container $app)
Create a new manager instance.
at line 82
void
routes(array|null $attributes = null)
Register the routes for handling broadcast channel authentication and sockets.
at line 102
void
userRoutes(array|null $attributes = null)
Register the routes for handling broadcast user authentication.
at line 124
void
channelRoutes(array|null $attributes = null)
Register the routes for handling broadcast authentication and sockets.
Alias of "routes" method.
at line 132
string|null
socket(Request|null $request = null)
Get the socket ID for the given request.
at line 146
AnonymousEvent
on(array|Channel|string $channels)
Begin sending an anonymous broadcast to the given channels.
at line 154
AnonymousEvent
private(string $channel)
Begin sending an anonymous broadcast to the given private channels.
at line 162
AnonymousEvent
presence(string $channel)
Begin sending an anonymous broadcast to the given presence channels.
at line 170
PendingBroadcast
event(mixed $event = null)
Begin broadcasting an event.
at line 181
void
queue(mixed $event)
Queue the given event for broadcast.
at line 238
protected bool
mustBeUniqueAndCannotAcquireLock(mixed $event)
Determine if the broadcastable event must be unique and determine if we can acquire the necessary lock.
at line 250
Broadcaster
connection(UnitEnum|string|null $driver = null)
Get a driver instance.
at line 258
Broadcaster
driver(UnitEnum|string|null $name = null)
Get a driver instance.
at line 274
protected Broadcaster
get(string $name)
Attempt to get the connection from the local cache.
at line 284
protected Broadcaster
resolve(string $name)
Resolve the given broadcaster with Pool Proxy if need.
at line 310
protected Broadcaster
doResolve(string|null $name, array $config)
Resolve the given broadcaster.
at line 340
protected Broadcaster
callCustomCreator(array $config)
Call a custom driver creator.
at line 348
protected Broadcaster
createReverbDriver(array $config)
Create an instance of the driver.
at line 356
protected Broadcaster
createPusherDriver(array $config)
Create an instance of the driver.
at line 364
Pusher
pusher(array $config)
Get a Pusher instance for the given configuration.
at line 395
protected Broadcaster
createAblyDriver(array $config)
Create an instance of the driver.
at line 403
AblyRest
ably(array $config)
Get an Ably instance for the given configuration.
at line 411
protected Broadcaster
createRedisDriver(array $config)
Create an instance of the driver.
at line 427
protected Broadcaster
createLogDriver(array $config)
Create an instance of the driver.
at line 435
protected Broadcaster
createNullDriver(array $config)
Create an instance of the driver.
at line 443
protected array|null
getConfig(string $name)
Get the connection configuration.
at line 463
string
getDefaultDriver()
Get the default driver name.
at line 473
void
setDefaultDriver(UnitEnum|string $name)
Set the default broadcast driver name.
Boot-only. Mutates process-global config; per-request use races across coroutines.
at line 487
void
purge(UnitEnum|string|null $name = null)
Disconnect the given driver and close its shared resource pool.
Boot or tests only, plus operational recovery of broken pooled resources. Other connections sharing the pool transparently acquire a fresh pool on their next operation.
at line 529
BroadcastManager
extend(string $driver, Closure $callback)
Register a custom driver creator Closure.
Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent broadcaster resolution.
at line 546
protected mixed
rescue(Closure $callback)
Execute the given callback using "rescue" if possible.
at line 558
Container
getApplication()
Get the application instance used by the manager.
at line 570
BroadcastManager
setApplication(Container $app)
Set the application instance used by the manager.
Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent request resolving broadcasters through this manager.
at line 583
BroadcastManager
forgetDrivers()
Forget all of the resolved driver instances.
Boot or tests only. This is cache-only: pooled broadcasters remain shared resources until purged or reclaimed by their idle TTL.
at line 593
mixed
__call(string $method, array $parameters)
Dynamically call the default driver instance.