modify plugin name
This commit is contained in:
@@ -4,12 +4,14 @@ namespace Kiri\Websocket;
|
||||
|
||||
use Kiri;
|
||||
use Swoole\{Coroutine\Http\Server as AliasServer, WebSocket\Server};
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Sender implements WebSocketInterface
|
||||
class Sender extends Kiri\Abstracts\Component implements WebSocketInterface
|
||||
{
|
||||
|
||||
|
||||
@@ -19,6 +21,20 @@ class Sender implements WebSocketInterface
|
||||
private AliasServer|Server|null $server = null;
|
||||
|
||||
|
||||
private FdCollector $collector;
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->collector = $this->getContainer()->get(FdCollector::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param AliasServer|Server $server
|
||||
*/
|
||||
@@ -43,9 +59,8 @@ class Sender implements WebSocketInterface
|
||||
if ($this->server instanceof Server) {
|
||||
return $this->server->push($fd, $data, $opcode, $flags);
|
||||
}
|
||||
$collector = Kiri::getContainer()->get(FdCollector::class);
|
||||
|
||||
$response = $collector->get($fd);
|
||||
$response = $this->collector->get($fd);
|
||||
if (!empty($response)) {
|
||||
return $response->push($data, $opcode, $flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user