mercureact/src/Broker/SseSubscriber.php

24 lines
449 B
PHP

<?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;
}
}