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

Subscription supported ? #1

Open
ghost opened this issue May 27, 2018 · 10 comments
Open

Subscription supported ? #1

ghost opened this issue May 27, 2018 · 10 comments

Comments

@ghost
Copy link

ghost commented May 27, 2018

I guess because protobuf and grpc does not model subscriptions it's impossible for the graphql to have subscriptions ?

@saturn4er
Copy link
Owner

Hi @gedw99, the problem is that GraphQL doesn't support subscriptions natively (they work like a query/mutation).

@ghost
Copy link
Author

ghost commented May 27, 2018

so for example you could use a query to poll into and get a response. Performance would of course not scale. But is that what you mean.. ?

@saturn4er
Copy link
Owner

Can you, please, share some example of how this should work?

@ghost
Copy link
Author

ghost commented May 29, 2018

Sorry but there are a ton examples.

Google for the 3 architectural solutions.

Polling

SSE - server side events

WS - web sockets.

@saturn4er
Copy link
Owner

As you can find, proto2gql generates only the schema and doesn't care about how it will be executed. So, what proto2gql should generate, to make it possible to handle streams?

@ghost
Copy link
Author

ghost commented Jun 2, 2018

web socket, or grpc-web

@saturn4er
Copy link
Owner

Hey @gedw99, currently I`m working on the next iteration of the generator which will be able to generate full-featured GraphQL API Gateway and there the subscriptions could be included. Please let me know and I will update you as soon as I finish.

@ghost
Copy link
Author

ghost commented Jul 14, 2018

hey @saturn4er sounds pretty nice.

your should not reinvent the wheel. Look at: https://github.com/z0mbie42/goes/tree/master/_examples/api

Because it is a event source base it makes it much easier to support subscriptions.
But you need either NATS or a DB to store which client gets the update pushed out and who already has it. Know what i mean ?
Many people use NATS embedded as it simplifies that trick concurrent aspect which is hard to get right.

Anyway if you have examples running i can help you ..

@saturn4er
Copy link
Owner

hey @gedw99, I don't really know what have you tried to make with this tool, and really don't understand what for do I need NATS or DB for subscription. I think it should work in such way:
When client try to execute GraphQL request with streams, our code calls GRPC method which returns channel. Than, as the server sends data, we receive it from channel and push it to client

@ghost
Copy link
Author

ghost commented Jul 18, 2018

Ok i totally get what your saying, and thats pretty obvious stuff. I was just trying to explain how to use it with a event sourcing architecture. This is how you really built a Subscription based system using your current graphql / grpc architecture. You see for subscriptions you need a way to track what each user gets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant