SessionSubscriptionManager implements SubscriptionManagerInterface
FinalYes
The default Subscription manager implementation manages subscriptions per session only.
It is in-memory and does not support cross-session or cross-client subscriptions.
The SDK allows injecting alternative SubscriptionManagerInterface implementations via Builder::setResourceSubscriptionManager().
Tags
Table of Contents
Interfaces
- SubscriptionManagerInterface
- Resource subscription interface.
Properties
- $logger : LoggerInterface
Methods
- __construct() : mixed
- isSubscribed() : bool
- Check if a session is subscribed to a resource URI.
- notifyResourceChanged() : void
- Notifies all sessions subscribed to the given resource URI that the resource has changed. Sends a ResourceUpdatedNotification for each subscriber.
- subscribe() : void
- Subscribes a session to a specific resource URI.
- unsubscribe() : void
- Unsubscribes a session from a specific resource URI.
Properties
$logger read-only
private
LoggerInterface
$logger
= new NullLogger()
Methods
__construct()
public
__construct([LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
- $logger : LoggerInterface = new NullLogger()
isSubscribed()
Check if a session is subscribed to a resource URI.
public
isSubscribed(SessionInterface $session, string $uri) : bool
Parameters
- $session : SessionInterface
- $uri : string
Tags
Return values
boolnotifyResourceChanged()
Notifies all sessions subscribed to the given resource URI that the resource has changed. Sends a ResourceUpdatedNotification for each subscriber.
public
notifyResourceChanged(Protocol $protocol, SessionInterface $session, string $uri) : void
Parameters
- $protocol : Protocol
- $session : SessionInterface
- $uri : string
Tags
subscribe()
Subscribes a session to a specific resource URI.
public
subscribe(SessionInterface $session, string $uri) : void
Parameters
- $session : SessionInterface
- $uri : string
Tags
unsubscribe()
Unsubscribes a session from a specific resource URI.
public
unsubscribe(SessionInterface $session, string $uri) : void
Parameters
- $session : SessionInterface
- $uri : string