phasync\Internal\Subscribers final class

Documentation

This class will read all messages from a ReadChannelInterface object, and allow other coroutines to subscribe to all messages emitted from that readchannel via a subscription object.

Inheritance

Implements: phasync\SubscribersInterface Traversable IteratorAggregate

Properties (6)

private static ?WeakMap $receiverStates
private phasync\Internal\ChannelMessage $lastMessage
private stdClass $notifyMessageFlag
private int $waiting
private ?Fiber $creatingFiber
private phasync\ReadChannelInterface $readChannel

Methods (5)

Documentation missing

Get a new subscription for the read channel.

Subscribe to messages via a generator.

Returns the first message that is available

Subscribers will be suspended until more data is available

Source

src/Internal/Subscribers.php:18-130