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 transports #403

Open
gedw99 opened this issue Nov 24, 2022 · 2 comments
Open

Subscription transports #403

gedw99 opened this issue Nov 24, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@gedw99
Copy link

gedw99 commented Nov 24, 2022

What would you like to be added:

I am wondering if there is merit in adding an option to use SSE for subscription updates ?

Why is this needed:

Partly because I am having problems with web sockets and so reaching out to see if SSE would be better. It’s a far simpler protocol .

I am also curious how the backend manages what users are subscribed to what . Is this able to be inspected somehow or even better to have that data available as a change stream over SSE.

@gedw99 gedw99 added the enhancement New feature or request label Nov 24, 2022
@dosco
Copy link
Owner

dosco commented Nov 24, 2022

I'm not familiar with SEE can you share some links? The backend groups (with sharding) subscriptions to a single query together (each subscriber can have different variables) into a single query execution and then polls for changes using this. If any unified response has updates then the subscribers who those updates are for are sent the updated result.

For example if 10K folks subscribe to a query for new blog posts and each of them has a different list of followers then this will result to about 20 queries to the db for every polling instance. In short as efficient as can be and designed to be horizontally scaleable and use the most efficient DB interface SQL itself.

@gedw99
Copy link
Author

gedw99 commented Dec 29, 2022

Ok so SSE is this: https://en.m.wikipedia.org/wiki/Server-sent_events

it’s built into browsers and there are golang ( and other libs ) for non browsers.

it’s quite a simple protocol.

This all came up for me because I was looking to decouple the subscription events transport from graphjin. For example I could stick the events into anything durable like a message queue and then push them out over SSE or a thing really. It’s basically a decoupling of the Transport for the Subscriptions. Sone people might even want to send a web hook to another server for example.

Thank you for the explanation of the Logic of how the system manages subscription. It’s an awesome design.

I am trying to come to grips with the client-side . A golang graphql package that works with graphjin subscription would be nice if you know of one. I could then experiment from the terminal with a minimal golang cli so I can experiment.

anyways looking forward to your thoughts.

@gedw99 gedw99 changed the title SSE based push ? Subscription transports Dec 29, 2022
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

2 participants