class
GraphQL::Broadcast(T)
- GraphQL::Broadcast(T)
- Reference
- Object
Overview
Fans values out to any number of subscribers, each receiving them on its
own channel. Meant for subscription resolvers: a mutation publishes, and
a subscription field returns #subscribe.
MESSAGES = GraphQL::Broadcast(Message).new
@[GraphQL::Field]
def message_added : Channel(Message)
MESSAGES.subscribe
end
Every subscriber channel buffers buffer values. A subscriber that has
not drained its buffer misses the next value rather than blocking the
publisher and every other subscriber. Closed channels are dropped on the
next publish.
Defined in:
graphql/broadcast.crConstructors
Instance Method Summary
- #close : Nil
- #publish(value : T) : Nil
-
#size : Int32
Number of open subscriber channels.
- #subscribe : Channel(T)
- #unsubscribe(channel : Channel(T)) : Nil