Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Are subscriptions supported? #76

Closed
KieranLafferty opened this issue Jan 29, 2020 · 13 comments
Closed

Are subscriptions supported? #76

KieranLafferty opened this issue Jan 29, 2020 · 13 comments
Labels
enhancement New feature or request

Comments

@KieranLafferty
Copy link

Hey there, tried searching but couldn't find any mention of subscription query types for gql. Wondering if they are currently supported and if not if there is any plan to support them?

thanks!

@comigor comigor added the enhancement New feature or request label Feb 1, 2020
@comigor
Copy link
Owner

comigor commented Feb 1, 2020

Hey there @KieranLafferty!

It's currently not supported. Frankly, I've never used subscriptions in GraphQL yet.

But I assume it's possible to stream typed data after transformations from the server (that'd be equal of what I'm currently doing on queries/mutations).

I won't promise I'll look at it soon (I'm working on a refactor of the generator/another middlewares branch), but if you feel energetic about it, I can assist you in that!

@agent3bood
Copy link

First of all thanks for this amazing lib, it is making things mush more fun to work with.

I have been using this package in a new project and I am using subscriptions,
I have few point that might help.

  1. The helper classes will NOT get generated when I have subscription operation.
  2. To make it work I use query in my user.graphql file and then change the type property on OperationDefinitionNode to OperationType.subscription
@override
  final DocumentNode document = DocumentNode(definitions: [
    OperationDefinitionNode(
-       type: OperationType.query,
+       type: OperationType.subscription,
        name: NameNode(value: 'users'),

@comigor
Copy link
Owner

comigor commented Apr 14, 2020

@agent3bood sorry man, I lost your comment.

I think it should be easy to implement the generator for subscriptions, with probably just some tweaks. I'll see if I can take a look at it soon.

@agent3bood
Copy link

@comigor thanks for the response, the generator is easy fix, but this library has a client also.
Does it support subscriptions?
I am using the graphql_flutter library for the client code and subscriptions are supported.

@comigor
Copy link
Owner

comigor commented Apr 21, 2020

@agent3bood Not at the moment, but I'm fairly sure gql's Link support Streams, and it could be adapted to Artemis!

@klavs
Copy link
Contributor

klavs commented Apr 25, 2020

FYI, here's a tracking issue for WebSocket Link implementation in gql. gql-dart/gql#76

The initial plan is to borrow it from package:graphql (https://github.com/zino-app/graphql-flutter/blob/master/packages/graphql/lib/src/link/web_socket/link_web_socket.dart).

Contributions are welcome. More gql Links mean more power to Artemis. 💪

@klavs
Copy link
Contributor

klavs commented May 6, 2020

FYI, an alpha version of a Websocket Link has been published. https://pub.dev/packages/gql_websocket_link

Feel free to try it out and report any issues at https://github.com/gql-dart/gql/issues.

@gouravd
Copy link

gouravd commented May 7, 2020

Is there a way to generate code for Subscriptions yet? If not what is the recommended way to use subscriptions with above Websocket Link or graphql client?

@comigor
Copy link
Owner

comigor commented May 8, 2020

I'll work on that, do you happen to know any public GraphQL server with subscriptions?

@comigor
Copy link
Owner

comigor commented May 8, 2020

@KieranLafferty @gouravd @agent3bood
Take a look at this PR, with an example of how to use Artemis with subscriptions: #133

@comigor
Copy link
Owner

comigor commented May 8, 2020

I'm going to keep this issue open for a while to hear your suggestions!

@KieranLafferty
Copy link
Author

Thanks @comigor looks great! Going to try it out and will get back to you once I've tired it out

@comigor
Copy link
Owner

comigor commented Jun 1, 2020

I'm going to close this, but feel free to reopen if necessary!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants