Example #1
0
 /**
  * @param Session $session
  * @param CallMessage $msg
  * @return bool
  */
 private function processCall(Session $session, CallMessage $msg)
 {
     $registration = $this->getRegistrationByProcedureName($msg->getProcedureName());
     if (!$registration) {
         $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
         $this->manager->error('No registration for call message: ' . $msg->getProcedureName());
         $errorMsg->setErrorURI('wamp.error.no_such_registration');
         $session->sendMessage($errorMsg);
         return false;
     }
     $invocationMessage = InvocationMessage::createMessageFrom($msg, $registration);
     if ($registration->getDiscloseCaller() === true && $session->getAuthenticationDetails()) {
         $details = ["caller" => $session->getSessionId(), "authid" => $session->getAuthenticationDetails()->getAuthId(), "authmethod" => $session->getAuthenticationDetails()->getAuthMethod()];
         $invocationMessage->setDetails($details);
     }
     $call = new Call($msg, $session, $invocationMessage, $registration->getSession());
     $this->calls->attach($call);
     $registration->getSession()->sendMessage($invocationMessage);
 }
Example #2
0
 /**
  * Process call
  *
  * @param \Thruway\Session $session
  * @param \Thruway\Message\CallMessage $msg
  * @return boolean
  */
 private function processCall(Session $session, CallMessage $msg)
 {
     if (!Utils::uriIsValid($msg->getProcedureName())) {
         $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.invalid_uri'));
         return;
     }
     if (!isset($this->procedures[$msg->getProcedureName()])) {
         $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.no_such_procedure'));
         return;
     }
     /* @var $procedure \Thruway\Procedure */
     $procedure = $this->procedures[$msg->getProcedureName()];
     $call = new Call($session, $msg, $procedure);
     $this->callInvocationIndex[$call->getInvocationRequestId()] = $call;
     $this->callRequestIndex[$msg->getRequestId()] = $call;
     $keepIndex = $procedure->processCall($session, $call);
     if (!$keepIndex) {
         $this->removeCall($call);
     }
 }