<?php
namespace App\Service;
use SocketIO\Emitter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
class EsSocket
{
private $redisClient;
private $socketEmitter;
public function __construct($redisDsn)
{
$this->redisClient = RedisAdapter::createConnection($redisDsn);
$this->socketEmitter = new Emitter($this->redisClient);
}
public function emit($event, $payload = [])
{
$this->socketEmitter->emit($event, $payload);
}
}