call() public method

Call
public call ( string $procedureName, array | mixed $arguments = null, array | mixed $argumentsKw = null, array | mixed $options = null ) : Promise
$procedureName string
$arguments array | mixed
$argumentsKw array | mixed
$options array | mixed
return React\Promise\Promise
 /**
  * Gets and published the topics state to this subscription
  *
  * @param Subscription $subscription
  * @return mixed
  */
 public function publishState(Subscription $subscription)
 {
     //Pause all non-state building event messages
     $subscription->pauseForState();
     $sessionId = $subscription->getSession()->getSessionId();
     $this->clientSession->call($this->getProcedureName(), [$subscription->getUri(), $sessionId, $subscription->getOptions(), $subscription->getSession()->getAuthenticationDetails()])->then(function ($res) use($subscription) {
         $pubId = null;
         if (isset($res[0])) {
             $pubId = $res[0];
         }
         $subscription->unPauseForState($pubId);
     }, function ($error) use($subscription) {
         Logger::error($this, "Could not call '{$this->getProcedureName()}' when restoring state");
         $subscription->unPauseForState();
     });
 }
示例#2
0
 /**
  * Handle on session start
  *
  * @param \Thruway\ClientSession $session
  * @param \Thruway\Transport\TransportInterface $transport
  */
 public function onSessionStart($session, $transport)
 {
     $this->thePromise->then(function () use($session) {
         $session->call('com.example.thefunction0', [])->then(function ($res) {
             echo "Done.\n";
             exit;
         });
     });
 }
示例#3
0
 /**
  * Handle on session start
  *
  * @param \Thruway\ClientSession $session
  * @param \Thruway\Transport\TransportInterface $transport
  */
 public function onSessionStart($session, $transport)
 {
     $session->register('com.example.add2', [$this, 'add2'])->then(function () use($session) {
         echo "Registered RPC\n";
         $session->call('com.example.add2', [2, 3])->then(function ($res) {
             echo "Got result: " . $res[0] . "\n";
             $this->setAttemptRetry(false);
             $this->session->shutdown();
         });
     });
 }
 /**
  * Handles session start
  *
  * @param \Thruway\ClientSession $session
  * @param \Thruway\Transport\TransportProviderInterface $transport
  */
 public function onSessionStart($session, $transport)
 {
     $session->register("thruway.auth.{$this->getMethodName()}.onhello", [$this, 'processHello'], ["replace_orphaned_session" => "yes"])->then(function () use($session) {
         $session->register("thruway.auth.{$this->getMethodName()}.onauthenticate", [$this, 'preProcessAuthenticate'], ["replace_orphaned_session" => "yes"])->then(function () use($session) {
             $registrations = new \stdClass();
             $registrations->onhello = "thruway.auth.{$this->getMethodName()}.onhello";
             $registrations->onauthenticate = "thruway.auth.{$this->getMethodName()}.onauthenticate";
             $session->call('thruway.auth.registermethod', [$this->getMethodName(), $registrations, $this->getAuthRealms()])->then(function ($args) {
                 Logger::debug($this, "Authentication Method Registration Successful: {$this->getMethodName()}");
             });
         });
     });
 }