Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Voryx/ThruwayBundle/Annotation/Subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Subscribe implements AnnotationInterface
*/
protected $value;

protected $disclosePublisher;

protected $serializerGroups;

protected $serializerEnableMaxDepthChecks;
Expand Down Expand Up @@ -50,6 +52,14 @@ public function getName()
return $this->value;
}

/**
* @return mixed
*/
public function getDisclosePublisher()
{
return $this->disclosePublisher;
}

/**
* @return mixed
*/
Expand Down
12 changes: 10 additions & 2 deletions src/Voryx/ThruwayBundle/WampKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see disclose_publisher only set if there is an option set, not for every subscribe.

];

$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);
}

/**
Expand Down