Skip to content

Subscription must return Async Iterable or Observable. Received: #149

Open
@japrogramer

Description

@japrogramer

Hello, I have previously gotten subscriptions to crudely work graphql-python/graphene#500 (comment)

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: <async_generator object ProductSubscritption.resolve_sub_product.<locals>.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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions