Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for batch GraphQL operations #18

Open
Thibaut-Fatus opened this issue Jun 13, 2019 · 2 comments
Open

Add support for batch GraphQL operations #18

Thibaut-Fatus opened this issue Jun 13, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Thibaut-Fatus
Copy link

Hi,

When trying to call multiple subscriptions from the same component, only the first subscription is registered by the server:

subscription mySubscription {
  firstSubscription {
    foo
  }
  secondSubscription {
    bar
  }
}

triggers the correct frame on the WS:

{
  id: "1",
  payload: {
    operationName: "mySubscription"
    query: "subscription mySubscription {
      firstSubscription {
        foo
        __typename
      }
      secondSubscription {
        bar
        __typename
      }
    },
    variables: {}
    type: "start"
  },
}

however only the firstSubscription subscribe method seems to be executed (when logging we only see this one being called)

Switching order like this

subscription mySubscription {
  secondSubscription {
    bar
  }
  firstSubscription {
    foo
  }
}

leads to only the secondSubscription subscribe method to be called.

frontend:
apollo-client: 1.4.0 (needed for compatibility issues)
subscriptions-transport-ws: 0.8.3

backend:
django==2.2.2
channels==2.2.0
django-channels-graphql-ws==0.2.0
graphene==2.1.5
graphene-django==2.2.0
graphql-core==2.1
graphql-relay==0.4.5

@Thibaut-Fatus
Copy link
Author

Thibaut-Fatus commented Jun 13, 2019

I tried with a node server, and it returns:
Subscription "mySubscription" must select only one top level field.

It might not be supported by graphql spec, and then we might need an error message instead.

@hozblok
Copy link
Contributor

hozblok commented Jun 20, 2019

Hi @Thibaut-Fatus ,

Thank you for your research. Yes, we do not support such batch operations now. We will think about how to work with this in future versions.

@hozblok hozblok added the enhancement New feature or request label Jun 20, 2019
@prokher prokher changed the title Multiple Subscriptions: only first subscription is actually subscribed to. Add support for batch GraphQL operations Aug 20, 2019
@prokher prokher self-assigned this Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants