class
GraphQL::Subscription
- GraphQL::Subscription
- Reference
- Object
Overview
A running subscription, returned by Schema#subscribe. Every event the
resolver's channel produces arrives as one response document.
subscription = schema.subscribe(%(subscription { messageAdded { text } }))
subscription.each { |response| socket.send(response) }
The stream ends when the resolver's channel closes. #close ends it from
the consumer side and closes the resolver's channel too, so the
application learns the subscriber is gone.
Defined in:
graphql/subscription.crInstance Method Summary
-
#close : Nil
Unsubscribes: closes the resolver's channel and the response stream.
- #closed? : Bool
-
#each(& : String -> ) : Nil
Yields every response until the stream ends.
-
#receive : String
Next response.
-
#receive? : String | Nil
Next response, or nil once the stream has ended.
-
#responses : Channel(String)
The raw response channel, for use in
select.