Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tidal committed Jul 20, 2016
2 parents e37beaa + 6162416 commit cec12bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### [0.3.0] - 2016-07-20

* Renamed methods dealing with meta subscriptions to be more distinct
- getSubscriptionCollection -> getMetaSubscriptionCollection
- setSubscriptionCollection -> setMetaSubscriptionCollection
- isSubscribed -> isMetaSubscribed

### [0.2.1] - 2016-07-19

* Reworked MonitorTrait to provide a generic interface for initial calls to wamp router
Expand Down
32 changes: 20 additions & 12 deletions src/Tidal/WampWatch/MonitorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ trait MonitorTrait
protected $isRunning = false;

/**
* @var SubscriptionCollection
* @var SubscriptionCollection collection for meta subscriptions
*/
protected $subscriptionCollection;
protected $metaSubscriptionCollection;

/**
* @var string
Expand Down Expand Up @@ -74,7 +74,7 @@ protected function setClientSession(ClientSession $session)
*/
public function start()
{
$this->getSubscriptionCollection()->subscribe()->done(function () {
$this->getMetaSubscriptionCollection()->subscribe()->done(function () {
$this->checkStarted();
});
$this->callInitialProcedure()->done(function () {
Expand All @@ -96,7 +96,7 @@ public function stop()
return false;
}

$this->getSubscriptionCollection()->unsubscribe();
$this->getMetaSubscriptionCollection()->unsubscribe();

$this->isRunning = false;
$this->emit('stop', [$this]);
Expand Down Expand Up @@ -129,14 +129,22 @@ public function isRunning()
return $this->isRunning;
}

/**
* @param \Tidal\WampWatch\Subscription\Collection $collection
*/
public function setMetaSubscriptionCollection(SubscriptionCollection $collection)
{
$this->metaSubscriptionCollection = $collection;
}

/**
* @return \Tidal\WampWatch\Subscription\Collection
*/
protected function getSubscriptionCollection()
public function getMetaSubscriptionCollection()
{
return isset($this->subscriptionCollection)
? $this->subscriptionCollection
: $this->subscriptionCollection = new SubscriptionCollection($this->session);
return isset($this->metaSubscriptionCollection)
? $this->metaSubscriptionCollection
: $this->metaSubscriptionCollection = new SubscriptionCollection($this->session);
}

protected function setInitialCall($pocedure, callable $callback)
Expand Down Expand Up @@ -173,7 +181,7 @@ protected function callInitialProcedure()
*/
protected function checkStarted()
{
if ($this->isSubscribed() &&
if ($this->isMetaSubscribed() &&
$this->initialCallDone &&
!$this->isRunning()
) {
Expand All @@ -182,12 +190,12 @@ protected function checkStarted()
}
}

protected function isSubscribed()
protected function isMetaSubscribed()
{
if (!$this->getSubscriptionCollection()->hasSubscription()) {
if (!$this->getMetaSubscriptionCollection()->hasSubscription()) {
return true;
}

return $this->getSubscriptionCollection()->isSubscribed();
return $this->getMetaSubscriptionCollection()->isSubscribed();
}
}
2 changes: 1 addition & 1 deletion src/Tidal/WampWatch/SessionMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected function validateSessionInfo($sessionInfo)
protected function initSetupCalls()
{
// @var \Tidal\WampWatch\Subscription\Collection
$collection = $this->getSubscriptionCollection();
$collection = $this->getMetaSubscriptionCollection();

$collection->addSubscription(self::SESSION_JOIN_TOPIC, function (array $res) {
$sessionInfo = $res[0];
Expand Down

0 comments on commit cec12bf

Please sign in to comment.