Implemented subscription logic

This commit is contained in:
2024-03-10 23:06:00 +01:00
parent 39869d605c
commit 87d47f8ce8
11 changed files with 125 additions and 43 deletions

View File

@ -0,0 +1,24 @@
<?php
namespace NoccyLabs\Mercureact\Broker;
use React\Stream\WritableStreamInterface;
class SseSubscriber implements SubscriberInterface
{
public function __construct(
private WritableStreamInterface $stream
)
{
}
public function deliver(Message $message): void
{
$this->stream->write($message->toString());
}
public function isAuthorized(string $topics): bool
{
return true;
}
}