trait CreatesMercureDrivers (View source)

Methods

createMercureDriver(array $config)

Create an instance of the driver.

HubInterface
mercure(array $config)

Get a Mercure hub instance for the given configuration.

HubInterface
frankenPhpMercure(array $config)

Get a Mercure hub instance backed by FrankenPHP's built-in hub.

bool
broadcastsToSynchronousMercureConnections(mixed $event)

Determine if the given event only targets Mercure connections publishing synchronously.

int
mercureSubscribeExpiration(array $config)

Get the subscriber token (and cookie) lifetime in whole seconds.

TokenFactoryInterface|null
mercureSubscribeFactory(array $config)

Get the subscriber token factory for the given Mercure configuration.

mercureChannelEncrypter(array $config)

Get the end-to-end channel encrypter for the given Mercure configuration.

array
mercurePublishClaims(array $config)

Get the additional JWT claims for the publisher side of the given Mercure configuration.

string
mercureSecret(array $config, string $side)

Get the JWT secret for the given side ("subscribe" or "publish") of the given Mercure configuration.

array
mercureClaims(array $config)

Get the additional JWT claims for the given Mercure configuration.

Details

protected Broadcaster createMercureDriver(array $config)

Create an instance of the driver.

Parameters

array $config

Return Value

Broadcaster

HubInterface mercure(array $config)

Get a Mercure hub instance for the given configuration.

Parameters

array $config

Return Value

HubInterface

protected HubInterface frankenPhpMercure(array $config)

Get a Mercure hub instance backed by FrankenPHP's built-in hub.

Parameters

array $config

Return Value

HubInterface

protected bool broadcastsToSynchronousMercureConnections(mixed $event)

Determine if the given event only targets Mercure connections publishing synchronously.

Parameters

mixed $event

Return Value

bool

protected int mercureSubscribeExpiration(array $config)

Get the subscriber token (and cookie) lifetime in whole seconds.

Parameters

array $config

Return Value

int

protected TokenFactoryInterface|null mercureSubscribeFactory(array $config)

Get the subscriber token factory for the given Mercure configuration.

Parameters

array $config

Return Value

TokenFactoryInterface|null

protected ChannelEncrypter|null mercureChannelEncrypter(array $config)

Get the end-to-end channel encrypter for the given Mercure configuration.

Parameters

array $config

Return Value

ChannelEncrypter|null

protected array mercurePublishClaims(array $config)

Get the additional JWT claims for the publisher side of the given Mercure configuration.

Parameters

array $config

Return Value

array

protected string mercureSecret(array $config, string $side)

Get the JWT secret for the given side ("subscribe" or "publish") of the given Mercure configuration.

Parameters

array $config
string $side

Return Value

string

protected array mercureClaims(array $config)

Get the additional JWT claims for the given Mercure configuration.

Parameters

array $config

Return Value

array