PHP Класс Vinelab\Minion\Client

Автор: Abed Halawi ([email protected])
Наследование: extends Thruway\Peer\Client
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$delegateProvider Provider The delegate provider instance.
$topicPrefix string The prefix to use when generating topics/.

Открытые методы

Метод Описание
__construct ( string $realm, array $providers ) Constructor.
call ( string $procedure, array $arguments = null, array $argumentsKw = null, array $options = null ) : Promise Call a registered procedure.
getDelegateProvider ( ) : Provider Get the delegate provider of this client.
getProviders ( ) : array Get the registered providers.
getTopicPrefix ( ) : string Get the topic prefix.
onSessionStart ( AbstractSession $session, Thruway\Transport\TransportInterface $transport ) Called when the server session has started which will call all the providers so that they perform whatever they have to do.
publish ( string $topic, array | mixed $arguments = null, array | mixed $argumentsKw = null, array $options = null ) : Promise Publish to a topic with the given data.
register ( string $topic, Closure $callback, array $options = null, boolean $isFunction = false ) : Promise Register a RPC.
setDelegateProvider ( Provider $provider ) Set the delegate provider of this client.
setTopicPrefix ( string $prefix ) Set the topic prefix.
start ( $debug = false, boolean $startLoop = true ) Start the transport.
subscribe ( string $topic, string | Closur\Closure $callback, array $options = null, boolean $isFunction = false ) : Promise Subscribe to a topic and specify a callback for it.
wrapWithProxy ( mixed $callback, boolean $isFunction = false ) : Closure Wrap the given callback with a proxy Closure.

Защищенные методы

Метод Описание
prepareTopic ( string $topic ) : string Prepare the topic by prefixing it with @property $prefix as a convenience for having to manually prefix every topic.

Приватные методы

Метод Описание
bootProviders ( ) Boot up the registered providers by calling their boot() method.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( string $realm, array $providers )
$realm string
$providers array

call() публичный Метод

Call a registered procedure.
public call ( string $procedure, array $arguments = null, array $argumentsKw = null, array $options = null ) : Promise
$procedure string
$arguments array
$argumentsKw array
$options array
Результат React\Promise\Promise

getDelegateProvider() публичный Метод

Get the delegate provider of this client.
public getDelegateProvider ( ) : Provider
Результат Provider

getProviders() публичный Метод

Get the registered providers.
public getProviders ( ) : array
Результат array

getTopicPrefix() публичный Метод

Get the topic prefix.
public getTopicPrefix ( ) : string
Результат string

onSessionStart() публичный Метод

Called when the server session has started which will call all the providers so that they perform whatever they have to do.
public onSessionStart ( AbstractSession $session, Thruway\Transport\TransportInterface $transport )
$session Thruway\AbstractSession
$transport Thruway\Transport\TransportInterface

prepareTopic() защищенный Метод

Prepare the topic by prefixing it with @property $prefix as a convenience for having to manually prefix every topic.
protected prepareTopic ( string $topic ) : string
$topic string
Результат string

publish() публичный Метод

Publish to a topic with the given data.
public publish ( string $topic, array | mixed $arguments = null, array | mixed $argumentsKw = null, array $options = null ) : Promise
$topic string
$arguments array | mixed
$argumentsKw array | mixed
$options array
Результат React\Promise\Promise

register() публичный Метод

Register a RPC.
public register ( string $topic, Closure $callback, array $options = null, boolean $isFunction = false ) : Promise
$topic string
$callback Closure
$options array
$isFunction boolean
Результат React\Promise\Promise

setDelegateProvider() публичный Метод

Set the delegate provider of this client.
public setDelegateProvider ( Provider $provider )
$provider Provider

setTopicPrefix() публичный Метод

Set the topic prefix.
public setTopicPrefix ( string $prefix )
$prefix string

start() публичный Метод

Start the transport.
public start ( $debug = false, boolean $startLoop = true )
$startLoop boolean

subscribe() публичный Метод

Subscribe to a topic and specify a callback for it.
См. также: Thruway\ClientSession::subscribe
public subscribe ( string $topic, string | Closur\Closure $callback, array $options = null, boolean $isFunction = false ) : Promise
$topic string The topic name.
$callback string | Closur\Closure The callable to be called when the topic received a publish.
$options array Will be passed straight to thruway @see \Thruway\ClientSession::subscribe
$isFunction boolean Specify whether you're passing in a function from a different scope, Set this to TRUE to avoid calling the passed callable from this provider's scope.
Результат React\Promise\Promise

wrapWithProxy() публичный Метод

The reason we use this is to be able to format the given $data into a Dictionary which makes it safer to work with them.
public wrapWithProxy ( mixed $callback, boolean $isFunction = false ) : Closure
$callback mixed
$isFunction boolean
Результат Closure

Описание свойств

$delegateProvider защищенное свойство

The delegate provider instance.
protected Provider,Vinelab\Minion $delegateProvider
Результат Provider

$topicPrefix защищенное свойство

The prefix to use when generating topics/.
protected string $topicPrefix
Результат string