protected function processSubscribe(Session $session, SubscribeMessage $msg)
    {
        // get a subscription group "hash"
        /** @var MatcherInterface $matcher */
        $matcher = $this->getMatcherForMatchType($msg->getMatchType());
        if ($matcher === false) {
            Logger::alert($this,
                "no matching match type for \"" . $msg->getMatchType() . "\" for URI \"" . $msg->getUri() . "\"");

            return;
        }

        if (!$matcher->uriIsValid($msg->getUri(), $msg->getOptions())) {
            $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
            $session->sendMessage($errorMsg->setErrorURI('wamp.error.invalid_uri'));

            return;
        }

        $matchHash = $matcher->getMatchHash($msg->getUri(), $msg->getOptions());

        if (!isset($this->subscriptionGroups[$matchHash])) {
            $this->subscriptionGroups[$matchHash] = new SubscriptionGroup($matcher, $msg->getUri(), $msg->getOptions());
        }

        /** @var SubscriptionGroup $subscriptionGroup */
        $subscriptionGroup = $this->subscriptionGroups[$matchHash];
        $subscription      = $subscriptionGroup->processSubscribe($session, $msg);

        $registry = $this->getStateHandlerRegistry();
        if ($registry !== null) {
            $registry->processSubscriptionAdded($subscription);
        }
    }
protected function processSubscribe(Session $session, SubscribeMessage $msg)
    {
        // get a subscription group "hash"
        /** @var MatcherInterface $matcher */
        $matcher = $this->getMatcherForMatchType($msg->getMatchType());
        if ($matcher === false) {
            Logger::alert($this,
                "no matching match type for \"" . $msg->getMatchType() . "\" for URI \"" . $msg->getUri() . "\"");

            return;
        }

        if (!$matcher->uriIsValid($msg->getUri(), $msg->getOptions())) {
            $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
            $session->sendMessage($errorMsg->setErrorURI('wamp.error.invalid_uri'));

            return;
        }

        $matchHash = $matcher->getMatchHash($msg->getUri(), $msg->getOptions());

        if (!isset($this->subscriptionGroups[$matchHash])) {
            $this->subscriptionGroups[$matchHash] = new SubscriptionGroup($matcher, $msg->getUri(), $msg->getOptions());
        }

        /** @var SubscriptionGroup $subscriptionGroup */
        $subscriptionGroup = $this->subscriptionGroups[$matchHash];
        $subscription      = $subscriptionGroup->processSubscribe($session, $msg);

        $registry = $this->getStateHandlerRegistry();
        if ($registry !== null) {
            $registry->processSubscriptionAdded($subscription);
        }
    }
protected function processSubscribe ( Session $ session , SubscribeMessage $ msg ) { // get a subscription group "hash" /** @var MatcherInterface $matcher */ $ matcher = $ this -> getMatcherForMatchType ( $ msg -> getMatchType ( ) ) ; if ( $ matcher === false ) { Logger :: alert ( $ this , "no matching match type for \"" . $ msg -> getMatchType ( ) . "\" for URI \"" . $ msg -> getUri ( ) . "\"" ) ; return ; } if ( ! $ matcher -> uriIsValid ( $ msg -> getUri ( ) , $ msg -> getOptions ( ) ) ) { $ errorMsg = ErrorMessage :: createErrorMessageFromMessage ( $ msg ) ; $ session -> sendMessage ( $ errorMsg -> setErrorURI ( 'wamp.error.invalid_uri' ) ) ; return ; } $ matchHash = $ matcher -> getMatchHash ( $ msg -> getUri ( ) , $ msg -> getOptions ( ) ) ; if ( ! isset ( $ this -> subscriptionGroups [ $ matchHash ] ) ) { $ this -> subscriptionGroups [ $ matchHash ] = new SubscriptionGroup ( $ matcher , $ msg -> getUri ( ) , $ msg -> getOptions ( ) ) ; } /** @var SubscriptionGroup $subscriptionGroup */ $ subscriptionGroup = $ this -> subscriptionGroups [ $ matchHash ] ; $ subscription = $ subscriptionGroup -> processSubscribe ( $ session , $ msg ) ; $ registry = $ this -> getStateHandlerRegistry ( ) ; if ( $ registry !== null ) { $ registry -> processSubscriptionAdded ( $ subscription ) ; } }
Process subscribe message

@param \Thruway\Session $session
@param \Thruway\Message\SubscribeMessage $msg
@throws \Exception
Process subscribe message