diff --git a/src/Ratchet/Wamp/TopicManager.php b/src/Ratchet/Wamp/TopicManager.php index bea1171..b019371 100644 --- a/src/Ratchet/Wamp/TopicManager.php +++ b/src/Ratchet/Wamp/TopicManager.php @@ -22,7 +22,7 @@ class TopicManager implements WsServerInterface, WampServerInterface { * {@inheritdoc} */ public function onOpen(ConnectionInterface $conn) { - $conn->WAMP->topics = new \SplObjectStorage; + $conn->WAMP->subscriptions = new \SplObjectStorage; $this->app->onOpen($conn); } @@ -39,12 +39,12 @@ class TopicManager implements WsServerInterface, WampServerInterface { public function onSubscribe(ConnectionInterface $conn, $topic) { $topicObj = $this->getTopic($topic); - if ($conn->WAMP->topics->contains($topicObj)) { + if ($conn->WAMP->subscriptions->contains($topicObj)) { return; } $this->topicLookup[$topic]->add($conn); - $conn->WAMP->topics->attach($topicObj); + $conn->WAMP->subscriptions->attach($topicObj); $this->app->onSubscribe($conn, $topicObj); } @@ -54,8 +54,8 @@ class TopicManager implements WsServerInterface, WampServerInterface { public function onUnsubscribe(ConnectionInterface $conn, $topic) { $topicObj = $this->getTopic($topic); - if ($conn->WAMP->topics->contains($topicObj)) { - $conn->WAMP->topics->detach($topicObj); + if ($conn->WAMP->subscriptions->contains($topicObj)) { + $conn->WAMP->subscriptions->detach($topicObj); } else { return; } diff --git a/tests/Ratchet/Tests/Wamp/TopicManagerTest.php b/tests/Ratchet/Tests/Wamp/TopicManagerTest.php index af2671f..0a6655b 100644 --- a/tests/Ratchet/Tests/Wamp/TopicManagerTest.php +++ b/tests/Ratchet/Tests/Wamp/TopicManagerTest.php @@ -89,7 +89,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase { $this->mngr->onSubscribe($this->conn, $name); - $this->assertTrue($this->conn->WAMP->topics->contains($topic)); + $this->assertTrue($this->conn->WAMP->subscriptions->contains($topic)); } public function testDoubleSubscriptionFiresOnce() { @@ -130,7 +130,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase { $this->mngr->onSubscribe($this->conn, $name); $this->mngr->onUnsubscribe($this->conn, $name); - $this->assertFalse($this->conn->WAMP->topics->contains($topic)); + $this->assertFalse($this->conn->WAMP->subscriptions->contains($topic)); } public function testOnPublishBubbles() {