diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b58053..672237d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ CHANGELOG * BC: The Session component implements HttpServerInterface instead of WsServerInterface * BC: PHP 5.3 no longer supported * BC: Update to newer version of react/socket dependency + * BC: WAMP topics reduced to 0 subscriptions are deleted, new subs to same name will result in new Topic instance * Significant performance enhancements * 0.3.6 (2017-01-06) diff --git a/src/Ratchet/Wamp/Topic.php b/src/Ratchet/Wamp/Topic.php index 7bde5e0..bca8f67 100644 --- a/src/Ratchet/Wamp/Topic.php +++ b/src/Ratchet/Wamp/Topic.php @@ -6,13 +6,6 @@ use Ratchet\ConnectionInterface; * A topic/channel containing connections that have subscribed to it */ class Topic implements \IteratorAggregate, \Countable { - /** - * If true the TopicManager will destroy this object if it's ever empty of connections - * @deprecated in v0.4 - * @type bool - */ - public $autoDelete = false; - private $id; private $subscribers; diff --git a/src/Ratchet/Wamp/TopicManager.php b/src/Ratchet/Wamp/TopicManager.php index 318b986..dd06ada 100644 --- a/src/Ratchet/Wamp/TopicManager.php +++ b/src/Ratchet/Wamp/TopicManager.php @@ -118,7 +118,7 @@ class TopicManager implements WsServerInterface, WampServerInterface { $this->topicLookup[$topic->getId()]->remove($conn); - if ($topic->autoDelete && 0 === $topic->count()) { + if (0 === $topic->count()) { unset($this->topicLookup[$topic->getId()]); } } diff --git a/tests/unit/Wamp/TopicManagerTest.php b/tests/unit/Wamp/TopicManagerTest.php index 8482877..b21b6bc 100644 --- a/tests/unit/Wamp/TopicManagerTest.php +++ b/tests/unit/Wamp/TopicManagerTest.php @@ -185,21 +185,18 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase { } public static function topicConnExpectationProvider() { - return array( - array(true, 'onClose', 0) - , array(true, 'onUnsubscribe', 0) - , array(false, 'onClose', 1) - , array(false, 'onUnsubscribe', 1) - ); + return [ + [ 'onClose', 0] + , ['onUnsubscribe', 0] + ]; } /** * @dataProvider topicConnExpectationProvider */ - public function testTopicRetentionFromLeavingConnections($autoDelete, $methodCall, $expectation) { + public function testTopicRetentionFromLeavingConnections($methodCall, $expectation) { $topicName = 'checkTopic'; list($topic, $attribute) = $this->topicProvider($topicName); - $topic->autoDelete = $autoDelete; $this->mngr->onSubscribe($this->conn, $topicName); call_user_func_array(array($this->mngr, $methodCall), array($this->conn, $topicName));