SharedResourceSubscriptions class
Reference-counted resources/subscribe over a client several consumers
share.
A device subscription is a property of the LINK, not of whoever asked for
it: the server knows only "subscribed" or "not". Once one connection per
device is shared — a device's own screen and a composed tile naming the same
device — two consumers end up on one subscription, and the first to release
it stops the stream for the other. Observed as a composed tile that streamed
until the device's own screen was visited and closed, after which it froze
and only moved one step per manual Subscribe.
So the wire call is made when the count goes 0 → 1, and again when it returns to 0. Everything in between is bookkeeping.
Counts hang off the client itself (an Expando), so they are shared by every consumer of that client without threading a registry through, and they disappear with it — no map to clean up when a device goes away.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
countFor(
Client client, String uri) → int -
How many consumers currently hold
uri. For tests and diagnostics. -
subscribe(
Client client, String uri) → Future< void> -
Subscribes on the wire only for the FIRST consumer of
uri. -
unsubscribe(
Client client, String uri) → Future< void> -
Unsubscribes on the wire only when the LAST consumer of
urireleases.