PHP Class Vinelab\Minion\Client

Author: Abed Halawi ([email protected])
Inheritance: extends Thruway\Peer\Client
Afficher le fichier Open project: vinelab/minion Class Usage Examples

Protected Properties

Свойство Type Description
$delegateProvider Provider The delegate provider instance.
$topicPrefix string The prefix to use when generating topics/.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
prepareTopic ( string $topic ) : string Prepare the topic by prefixing it with @property $prefix as a convenience for having to manually prefix every topic.

Private Methods

Méthode Description
bootProviders ( ) Boot up the registered providers by calling their boot() method.

Method Details

__construct() public méthode

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

call() public méthode

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
Résultat React\Promise\Promise

getDelegateProvider() public méthode

Get the delegate provider of this client.
public getDelegateProvider ( ) : Provider
Résultat Provider

getProviders() public méthode

Get the registered providers.
public getProviders ( ) : array
Résultat array

getTopicPrefix() public méthode

Get the topic prefix.
public getTopicPrefix ( ) : string
Résultat string

onSessionStart() public méthode

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() protected méthode

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
Résultat string

publish() public méthode

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
Résultat React\Promise\Promise

register() public méthode

Register a RPC.
public register ( string $topic, Closure $callback, array $options = null, boolean $isFunction = false ) : Promise
$topic string
$callback Closure
$options array
$isFunction boolean
Résultat React\Promise\Promise

setDelegateProvider() public méthode

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

setTopicPrefix() public méthode

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

start() public méthode

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

subscribe() public méthode

Subscribe to a topic and specify a callback for it.
See also: 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.
Résultat React\Promise\Promise

wrapWithProxy() public méthode

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
Résultat Closure

Property Details

$delegateProvider protected_oe property

The delegate provider instance.
protected Provider,Vinelab\Minion $delegateProvider
Résultat Provider

$topicPrefix protected_oe property

The prefix to use when generating topics/.
protected string $topicPrefix
Résultat string