diff --git a/src/Voryx/ThruwayBundle/Annotation/Subscribe.php b/src/Voryx/ThruwayBundle/Annotation/Subscribe.php index d820224..3640649 100644 --- a/src/Voryx/ThruwayBundle/Annotation/Subscribe.php +++ b/src/Voryx/ThruwayBundle/Annotation/Subscribe.php @@ -22,6 +22,8 @@ class Subscribe implements AnnotationInterface */ protected $value; + protected $disclosePublisher; + protected $serializerGroups; protected $serializerEnableMaxDepthChecks; @@ -50,6 +52,14 @@ public function getName() return $this->value; } + /** + * @return mixed + */ + public function getDisclosePublisher() + { + return $this->disclosePublisher; + } + /** * @return mixed */ diff --git a/src/Voryx/ThruwayBundle/WampKernel.php b/src/Voryx/ThruwayBundle/WampKernel.php index a06d069..4ede639 100644 --- a/src/Voryx/ThruwayBundle/WampKernel.php +++ b/src/Voryx/ThruwayBundle/WampKernel.php @@ -228,14 +228,22 @@ public function handleRPC($args, $argsKw, $details, MappingInterface $mapping) */ protected function createSubscribe(MappingInterface $mapping) { - $topic = $mapping->getAnnotation()->getName(); + /* @var $annotation Subscribe */ + $annotation = $mapping->getAnnotation(); + $disclosePublisher = $annotation->getDisclosePublisher() !== null ? $annotation->getDisclosePublisher() : true; + $topic = $annotation->getName(); + + //Subscribe Options + $subscribeOptions = [ + 'disclose_publisher' => $disclosePublisher + ]; $subscribeCallback = function ($args, $argsKw, $details) use ($mapping) { $this->handleEvent($args, $argsKw, $details, $mapping); }; //Subscribe to a topic - $this->session->subscribe($topic, $subscribeCallback); + $this->session->subscribe($topic, $subscribeCallback, $subscribeOptions); } /**