36 lines
734 B
PHP
36 lines
734 B
PHP
<?php
|
|
|
|
namespace Mine\SeekerBundle\Periodic;
|
|
|
|
use Gos\Bundle\WebSocketBundle\Periodic\PdoPeriodicPing;
|
|
use Gos\Bundle\WebSocketBundle\Periodic\PeriodicInterface;
|
|
|
|
class MinePeriodic implements PeriodicInterface
|
|
{
|
|
/** @var PdoPeriodicPing */
|
|
private $ping;
|
|
|
|
public function __construct(PdoPeriodicPing $ping)
|
|
{
|
|
$this->ping = $ping;
|
|
}
|
|
|
|
/**
|
|
* This function is executed every 5 seconds.
|
|
*
|
|
* For more advanced functionality, try injecting a Topic Service to perform actions on your connections every x seconds.
|
|
*/
|
|
public function tick()
|
|
{
|
|
$this->ping->tick();
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getTimeout()
|
|
{
|
|
return 300;
|
|
}
|
|
}
|