new: usr: add mineseeker game to the symfony 4 project #3
This commit is contained in:
35
src/Periodic/MinePeriodic.php
Normal file
35
src/Periodic/MinePeriodic.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user