Thruway\ClientSession::sendMessage PHP Method

sendMessage() public method

public sendMessage ( Thruway\Message\Message $msg ) : mixed | void
$msg Thruway\Message\Message
return mixed | void
    public function sendMessage(Message $msg)
    {
        $this->transport->sendMessage($msg);
    }

Usage Example

コード例 #1
0
ファイル: Callee.php プロジェクト: pacho104/redbpim
 /**
  * process unregister
  *
  * @param \Thruway\ClientSession $session
  * @param string $Uri
  * @throws \Exception
  * @return \React\Promise\Promise|false
  */
 public function unregister(ClientSession $session, $Uri)
 {
     // TODO: maybe add an option to wait for pending calls to finish
     $registration = null;
     foreach ($this->registrations as $k => $r) {
         if (isset($r['procedure_name'])) {
             if ($r['procedure_name'] == $Uri) {
                 $registration =& $this->registrations[$k];
                 break;
             }
         }
     }
     if ($registration === null) {
         Logger::warning($this, "registration not found: " . $Uri);
         return false;
     }
     // we remove the callback from the client here
     // because we don't want the client to respond to any more calls
     $registration['callback'] = null;
     $futureResult = new Deferred();
     if (!isset($registration["registration_id"])) {
         // this would happen if the registration was never acknowledged by the router
         // we should remove the registration and resolve any pending deferreds
         Logger::error($this, "Registration ID is not set while attempting to unregister " . $Uri);
         // reject the pending registration
         $registration['futureResult']->reject();
         // TODO: need to figure out what to do in this off chance
         // We should still probably return a promise here that just rejects
         // there is an issue with the pending registration too that
         // the router may have a "REGISTERED" in transit and may still think that is
         // good to go - so maybe still send the unregister?
     }
     $requestId = Session::getUniqueId();
     // save the request id so we can find this in the registration
     // list to call the deferred and remove it from the list
     $registration['unregister_request_id'] = $requestId;
     $registration['unregister_deferred'] = $futureResult;
     $unregisterMsg = new UnregisterMessage($requestId, $registration['registration_id']);
     $session->sendMessage($unregisterMsg);
     return $futureResult->promise();
 }
All Usage Examples Of Thruway\ClientSession::sendMessage