mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:54:03 +00:00
broadcast channel prefix bootstrapper: add reverb() method
This commit is contained in:
parent
8a4644630a
commit
252e337ef8
1 changed files with 16 additions and 3 deletions
|
|
@ -80,10 +80,10 @@ class BroadcastChannelPrefixBootstrapper implements TenancyBootstrapper
|
||||||
* extends PusherBroadcaster, and overrides the formatChannels() method,
|
* extends PusherBroadcaster, and overrides the formatChannels() method,
|
||||||
* such that e.g. 'private-channel' becomes 'private-tenantKey.channel'.
|
* such that e.g. 'private-channel' becomes 'private-tenantKey.channel'.
|
||||||
*/
|
*/
|
||||||
public static function pusher(Closure|null $override = null): void
|
public static function pusher(Closure|null $override = null, string $driver = 'pusher'): void
|
||||||
{
|
{
|
||||||
static::$broadcasterOverrides['pusher'] = $override ?? function (BroadcastManager $broadcastManager): void {
|
static::$broadcasterOverrides[$driver] = $override ?? function (BroadcastManager $broadcastManager) use ($driver): void {
|
||||||
$broadcastManager->extend('pusher', function ($app, $config) use ($broadcastManager) {
|
$broadcastManager->extend($driver, function ($app, $config) use ($broadcastManager) {
|
||||||
return new class($broadcastManager->pusher($config)) extends PusherBroadcaster {
|
return new class($broadcastManager->pusher($config)) extends PusherBroadcaster {
|
||||||
protected function formatChannels(array $channels)
|
protected function formatChannels(array $channels)
|
||||||
{
|
{
|
||||||
|
|
@ -113,6 +113,19 @@ class BroadcastChannelPrefixBootstrapper implements TenancyBootstrapper
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the closure that overrides the 'reverb' broadcaster.
|
||||||
|
*
|
||||||
|
* By default, override the 'reverb' broadcaster with a broadcaster that
|
||||||
|
* extends PusherBroadcaster, and overrides the formatChannels() method,
|
||||||
|
* such that e.g. 'private-channel' becomes 'private-tenantKey.channel'.
|
||||||
|
*/
|
||||||
|
public static function reverb(Closure|null $override = null): void
|
||||||
|
{
|
||||||
|
// Reverb reuses Pusher classes, but changes the name to 'reverb'
|
||||||
|
static::pusher($override, driver: 'reverb');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the closure that overrides the 'ably' broadcaster.
|
* Set the closure that overrides the 'ably' broadcaster.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue