src/Service/EsSocket.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Service;
  3. use SocketIO\Emitter;
  4. use Symfony\Component\Cache\Adapter\RedisAdapter;
  5. class EsSocket
  6. {
  7.     private $redisClient;
  8.     private $socketEmitter;
  9.     public function __construct($redisDsn)
  10.     {
  11.         $this->redisClient RedisAdapter::createConnection($redisDsn);
  12.         $this->socketEmitter = new Emitter($this->redisClient);
  13.     }
  14.     public function emit($event$payload = [])
  15.     {
  16.         $this->socketEmitter->emit($event$payload);
  17.     }
  18. }