gql-next icon indicating copy to clipboard operation
gql-next copied to clipboard

websocket / subscriptions support?

Open waterdrop01 opened this issue 5 years ago • 2 comments

Hi there,

I was wondering if there is support for websocket subscriptions?

Thank you!

waterdrop01 avatar Feb 27 '19 08:02 waterdrop01

@waterdrop01 I didn't think about it... if you can think of how to render a Python code for a subscription it should be very easy to add...

ekampf avatar Mar 04 '19 18:03 ekampf

Sorry I fear I'm not familiar enough with Python and its async library to provide a relevant feedback regarding API design.

If this helps, in JS, this doc shows how subscription client is created, and here is the subscription API:

apolloClient.subscribe({
  query: gql`
    subscription onNewItem {
        newItemCreated {
            id
        }
    }`,
  variables: {}
}).subscribe({
  next (data) {
    // Notify your application with the new arrived data
  }
});

Also, you may have a look at this Python gql client that apparently supports subscriptions: https://github.com/tdip/gql-subscriptions/tree/develop

waterdrop01 avatar Mar 05 '19 11:03 waterdrop01