graphql-python / graphql-python/graphql-core-legacy

Subscription must return Async Iterable or Observable. Received:

Open
#149 26 comments 11 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
371
Forks
175
PR merge metrics
No merged PRs in 30d

Description

Hello, I have previously gotten subscriptions to crudely work https://github.com/graphql-python/graphene/pull/500#issuecomment-325560994

But now i want to try the new version of the graphql-core library and here is how far I've gotten. It is not very clear to me what a Async Iterable is meant to be I assumed that its a Async generator?

but from this line it seems to be anything that is an instance of an Observable
https://github.com/graphql-python/graphql-core/blob/0b0551e7dfb724dedc66759145b9221595ec8598/graphql/execution/executor.py#L296
Is there any documentation for graphql-cores new approach to subscriptions .. I would very much like to learn more.

Here is what im trying
```
[GraphQLError('Subscription must return Async Iterable or Observable. Received: .compat at 0x7f6335e89d48>',)]

def resolve_sub_product(self, info, **input):
async def compat(result, delay):
yield result
await asyncio.sleep(delay)
return compat(make_sub(info, input.get('product')), .1)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with graphql/execution/executor.py around line 296 and review the linked graphql-core approach to subscriptions. Document what return values are supported, including async iterables and Observables, and explain how the shown async-generator resolver should be understood. Done means a newcomer can determine how to implement a subscription without relying on the discussion thread.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.