You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function TopicPeriodicTimerInterface::registerPeriodicTimer takes a Topic parameter, but once the first Topic registers a timer, it is not called for any additional Topic. Furthermore, if any one Topic has zero connections, any and all timers registered within the TopicInterface are cleared.
Example code
<?phpnamespaceApp\Websocket\Topic;
useGos\Bundle\WebSocketBundle\Topic\TopicPeriodicTimerInterface;
useGos\Bundle\WebSocketBundle\Topic\TopicPeriodicTimerTrait;
useRatchet\Wamp\Topic;
class AcmePeriodicTopic extends AcmeTopic implements TopicPeriodicTimerInterface
{
use TopicPeriodicTimerTrait;
publicfunctionregisterPeriodicTimer(Topic$topic): void
{
// Adds the periodic timer the first time a client connects to the topic$this->periodicTimer->addPeriodicTimer(
$this,
'hello',
300,
function () use ($topic) {
$topic->broadcast('Hello world');
}
);
}
/** * Name of the topic. */publicfunctiongetName(): string
{
return'acme.periodic.topic';
}
}
Steps
client 1 subscribes to acme/foo
timer is registered for acme/foo
client 2 subscribes to acme/bar
timer isn't registered for acme/bar
client 2 unsubscribes from acme/bar
timer is cleared for acme/foo
The text was updated successfully, but these errors were encountered:
The root problem is that TopicPeriodicTimer::addPeriodicTimer doesn't take the Topic passed to TopicPeriodicTimerInterface::registerPeriodicTimer as a parameter.
Description
The function
TopicPeriodicTimerInterface::registerPeriodicTimer
takes aTopic
parameter, but once the firstTopic
registers a timer, it is not called for any additionalTopic
. Furthermore, if any oneTopic
has zero connections, any and all timers registered within theTopicInterface
are cleared.Example code
Steps
acme/foo
acme/foo
acme/bar
acme/bar
acme/bar
acme/foo
The text was updated successfully, but these errors were encountered: