class Hub extends PoolProxy implements RemoteHubInterface

Keep a publishing client's network state exclusive to its current coroutine.

Properties

protected string $cookieName

Methods

__construct(PoolDefinition $definition, Closure $createClient, Factory $pools, UrlGenerator $urls, string $url, TokenProviderInterface $jwtProvider, TokenFactoryInterface|null $jwtFactory = null, string|null $publicUrl = null, string|null $cookieName = null)

Create a hub backed by reusable HTTP clients.

pool()

Resolve the current pool for this proxy's definition.

lease()

Borrow an object under an exactly-once lease.

mixed
invoke(string $method, array $arguments)

Invoke a synchronous method on a borrowed object.

void
configureBorrowed(object $object)

Apply proxy-held state to a freshly borrowed object.

getDefinition()

Get this proxy's immutable pool definition.

string
getPoolName()

Return the pool's fully qualified registry name.

bool
invalidatePool()

Remove and close this proxy's current shared pool.

string
getUrl()

Get the publishing URL for the current request or application origin.

string
getPublicUrl()

Get the public URL for the current request or application origin.

TokenProviderInterface
getProvider()

Get the publisher token provider.

TokenFactoryInterface|null
getFactory()

Get the subscriber token factory.

ProtocolVersion
getProtocolVersion()

Get the Mercure protocol version.

string
getCookieName()

Get the subscriber authorization cookie name.

string
publish(Update $update)

Publish an update while holding its HTTP client through response consumption.

Details

at line 34
__construct(PoolDefinition $definition, Closure $createClient, Factory $pools, UrlGenerator $urls, string $url, TokenProviderInterface $jwtProvider, TokenFactoryInterface|null $jwtFactory = null, string|null $publicUrl = null, string|null $cookieName = null)

Create a hub backed by reusable HTTP clients.

Parameters

PoolDefinition $definition
Closure $createClient
Factory $pools
UrlGenerator $urls
string $url
TokenProviderInterface $jwtProvider
TokenFactoryInterface|null $jwtFactory
string|null $publicUrl
string|null $cookieName

in PoolProxy at line 29
protected ObjectPool pool()

Resolve the current pool for this proxy's definition.

Return Value

ObjectPool

in PoolProxy at line 37
protected Lease lease()

Borrow an object under an exactly-once lease.

Return Value

Lease

in PoolProxy at line 55
protected mixed invoke(string $method, array $arguments)

Invoke a synchronous method on a borrowed object.

Parameters

string $method
array $arguments

Return Value

mixed

in PoolProxy at line 73
protected void configureBorrowed(object $object)

Apply proxy-held state to a freshly borrowed object.

Parameters

object $object

Return Value

void

in PoolProxy at line 80
PoolDefinition getDefinition()

Get this proxy's immutable pool definition.

Return Value

PoolDefinition

in PoolProxy at line 88
string getPoolName()

Return the pool's fully qualified registry name.

Return Value

string

in PoolProxy at line 96
bool invalidatePool()

Remove and close this proxy's current shared pool.

Return Value

bool

at line 53
string getUrl()

Get the publishing URL for the current request or application origin.

Return Value

string

at line 61
string getPublicUrl()

Get the public URL for the current request or application origin.

Return Value

string

at line 69
TokenProviderInterface getProvider()

Get the publisher token provider.

Return Value

TokenProviderInterface

at line 77
TokenFactoryInterface|null getFactory()

Get the subscriber token factory.

Return Value

TokenFactoryInterface|null

at line 85
ProtocolVersion getProtocolVersion()

Get the Mercure protocol version.

Return Value

ProtocolVersion

at line 93
string getCookieName()

Get the subscriber authorization cookie name.

Return Value

string

at line 101
string publish(Update $update)

Publish an update while holding its HTTP client through response consumption.

Parameters

Update $update

Return Value

string