2024-03-10 22:06:00 +00:00
|
|
|
<?php
|
|
|
|
|
2024-03-13 23:32:44 +00:00
|
|
|
namespace NoccyLabs\Mercureact\Broker\Subscriber;
|
|
|
|
|
|
|
|
use NoccyLabs\Mercureact\Broker\Message;
|
2024-03-10 22:06:00 +00:00
|
|
|
|
|
|
|
interface SubscriberInterface
|
|
|
|
{
|
2024-03-13 23:45:26 +00:00
|
|
|
/**
|
|
|
|
* Deliver a message to the subscriber.
|
|
|
|
*
|
|
|
|
* @param Message $message
|
|
|
|
* @return void
|
|
|
|
*/
|
2024-03-10 22:06:00 +00:00
|
|
|
public function deliver(Message $message): void;
|
|
|
|
|
2024-03-13 23:45:26 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the subscriber has athenticated.
|
|
|
|
*
|
|
|
|
* @return bool true if the subscriber has provided valid credentials
|
|
|
|
*/
|
|
|
|
public function isAuthenticated(): bool;
|
2024-03-12 00:45:21 +00:00
|
|
|
|
2024-03-14 13:03:27 +00:00
|
|
|
/**
|
|
|
|
* Returns the content of the JWT mercure claim if present.
|
|
|
|
*
|
|
|
|
* @return array|null
|
|
|
|
*/
|
|
|
|
public function getMercureClaims(): ?array;
|
|
|
|
|
2024-03-13 23:45:26 +00:00
|
|
|
/**
|
|
|
|
* Returns the content of the JWT mercure.payload claim if present.
|
|
|
|
*
|
|
|
|
* @return array|null
|
|
|
|
*/
|
2024-03-12 00:45:21 +00:00
|
|
|
public function getPayload(): ?array;
|
2024-03-12 01:21:42 +00:00
|
|
|
|
2024-03-13 23:45:26 +00:00
|
|
|
/**
|
|
|
|
* Get the unique subscriber ID, in the form 'urn:uuid:...'
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2024-03-12 01:21:42 +00:00
|
|
|
public function getId(): string;
|
2024-03-10 22:06:00 +00:00
|
|
|
}
|