class BroadcastManager implements Factory mixin Broadcaster (View source)

Properties

protected Container $app

The application instance.

protected array $drivers

The array of resolved broadcast drivers.

protected array $customCreators

The registered custom driver creators.

Methods

void
__construct(Container $app)

Create a new manager instance.

void
routes(array|null $attributes = null)

Register the routes for handling broadcast channel authentication and sockets.

void
userRoutes(array|null $attributes = null)

Register the routes for handling broadcast user authentication.

void
channelRoutes(array|null $attributes = null)

Register the routes for handling broadcast authentication and sockets.

string|null
socket(Request|null $request = null)

Get the socket ID for the given request.

on(Channel|string|array $channels)

Begin sending an anonymous broadcast to the given channels.

private(string $channel)

Begin sending an anonymous broadcast to the given private channels.

presence(string $channel)

Begin sending an anonymous broadcast to the given presence channels.

event(mixed|null $event = null)

Begin broadcasting an event.

void
queue(mixed $event)

Queue the given event for broadcast.

bool
mustBeUniqueAndCannotAcquireLock(mixed $event)

Determine if the broadcastable event must be unique and determine if we can acquire the necessary lock.

connection(string|null $driver = null)

Get a driver instance.

mixed
driver(string|null $name = null)

Get a driver instance.

get(string $name)

Attempt to get the connection from the local cache.

resolve(string $name)

Resolve the given broadcaster.

mixed
callCustomCreator(array $config)

Call a custom driver creator.

createReverbDriver(array $config)

Create an instance of the driver.

createPusherDriver(array $config)

Create an instance of the driver.

Pusher
pusher(array $config)

Get a Pusher instance for the given configuration.

createAblyDriver(array $config)

Create an instance of the driver.

AblyRest
ably(array $config)

Get an Ably instance for the given configuration.

createRedisDriver(array $config)

Create an instance of the driver.

createLogDriver(array $config)

Create an instance of the driver.

createNullDriver(array $config)

Create an instance of the driver.

array
getConfig(string $name)

Get the connection configuration.

string
getDefaultDriver()

Get the default driver name.

void
setDefaultDriver(string $name)

Set the default driver name.

void
purge(string|null $name = null)

Disconnect the given disk and remove from local cache.

$this
extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

getApplication()

Get the application instance used by the manager.

$this
setApplication(Application $app)

Set the application instance used by the manager.

$this
forgetDrivers()

Forget all of the resolved driver instances.

mixed
__call(string $method, array $parameters)

Dynamically call the default driver instance.

Details

void __construct(Container $app)

Create a new manager instance.

Parameters

Container $app

Return Value

void

void routes(array|null $attributes = null)

Register the routes for handling broadcast channel authentication and sockets.

Parameters

array|null $attributes

Return Value

void

void userRoutes(array|null $attributes = null)

Register the routes for handling broadcast user authentication.

Parameters

array|null $attributes

Return Value

void

void channelRoutes(array|null $attributes = null)

Register the routes for handling broadcast authentication and sockets.

Alias of "routes" method.

Parameters

array|null $attributes

Return Value

void

string|null socket(Request|null $request = null)

Get the socket ID for the given request.

Parameters

Request|null $request

Return Value

string|null

AnonymousEvent on(Channel|string|array $channels)

Begin sending an anonymous broadcast to the given channels.

Parameters

Channel|string|array $channels

Return Value

AnonymousEvent

AnonymousEvent private(string $channel)

Begin sending an anonymous broadcast to the given private channels.

Parameters

string $channel

Return Value

AnonymousEvent

AnonymousEvent presence(string $channel)

Begin sending an anonymous broadcast to the given presence channels.

Parameters

string $channel

Return Value

AnonymousEvent

PendingBroadcast event(mixed|null $event = null)

Begin broadcasting an event.

Parameters

mixed|null $event

Return Value

PendingBroadcast

void queue(mixed $event)

Queue the given event for broadcast.

Parameters

mixed $event

Return Value

void

protected bool mustBeUniqueAndCannotAcquireLock(mixed $event)

Determine if the broadcastable event must be unique and determine if we can acquire the necessary lock.

Parameters

mixed $event

Return Value

bool

Broadcaster connection(string|null $driver = null)

Get a driver instance.

Parameters

string|null $driver

Return Value

Broadcaster

mixed driver(string|null $name = null)

Get a driver instance.

Parameters

string|null $name

Return Value

mixed

protected Broadcaster get(string $name)

Attempt to get the connection from the local cache.

Parameters

string $name

Return Value

Broadcaster

protected Broadcaster resolve(string $name)

Resolve the given broadcaster.

Parameters

string $name

Return Value

Broadcaster

Exceptions

InvalidArgumentException

protected mixed callCustomCreator(array $config)

Call a custom driver creator.

Parameters

array $config

Return Value

mixed

protected Broadcaster createReverbDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

protected Broadcaster createPusherDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

Pusher pusher(array $config)

Get a Pusher instance for the given configuration.

Parameters

array $config

Return Value

Pusher

protected Broadcaster createAblyDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

AblyRest ably(array $config)

Get an Ably instance for the given configuration.

Parameters

array $config

Return Value

AblyRest

protected Broadcaster createRedisDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

protected Broadcaster createLogDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

protected Broadcaster createNullDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

protected array getConfig(string $name)

Get the connection configuration.

Parameters

string $name

Return Value

array

string getDefaultDriver()

Get the default driver name.

Return Value

string

void setDefaultDriver(string $name)

Set the default driver name.

Parameters

string $name

Return Value

void

void purge(string|null $name = null)

Disconnect the given disk and remove from local cache.

Parameters

string|null $name

Return Value

void

$this extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

Parameters

string $driver
Closure $callback

Return Value

$this

Application getApplication()

Get the application instance used by the manager.

Return Value

Application

$this setApplication(Application $app)

Set the application instance used by the manager.

Parameters

Application $app

Return Value

$this

$this forgetDrivers()

Forget all of the resolved driver instances.

Return Value

$this

mixed __call(string $method, array $parameters)

Dynamically call the default driver instance.

Parameters

string $method
array $parameters

Return Value

mixed