-
Notifications
You must be signed in to change notification settings - Fork 132
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
PubSubEngine and AsyncIterator state? #121
Comments
Any news on that? I would also be very interested. |
Hi @jthegedus PubSubEngine is just abstract class which is describing interface or "contract" for others to implement. It will allow to create libraries like To your second question, on what code is executed when you publish something - it basically depends on what you are listening, if you did not created triggers for which you are publishing event, then nothing happens, otherwise async iterator created listeners here
|
@dusan-dragon Thanks for your response. I was trying to get to the bottom of where the state of the subscription->event pairing was stored and whether or not a plugin would be able to configure that location. @benseitz Feel free to reopen if you have any unanswered questions from this thread. |
[Edit] I'm going to do some more reading and see if I can figure this out myself. Will update with answers or a more succinct question once I've done so. Essentially I want to know the following. What state is kept and how are things triggered (shown in code, not just some diagram) across these parts of a GraphQL Subscription Server:
Firstly, can someone please clarify the purpose of the PubSubEngine for me. Is it meant to notify other instances of the GraphQL server that a subscribe event needs to fire, or is it's
publish
used to fire the subscribe event on the current instance, or both? If it indeed does fire the subscribe event whenpublish
is called, what GraphQL server code is then executed next? How does this call ultimately get to the point where it pushes data to the client?What code in the GraphQL server gets executed during/after
publish
is called? Eg, in this repo, what's executed by this linethis.ee.emit(triggerName, payload);
I also have some questions about how the state is managed across the PubSubEngine and AsyncIterator.
For instance, in the
unsubscribe
method of the PubSubEngine, the signature says it requires asubId: number
which I assume is the same id returned from the PubSubsubscribe
method. Is thesubId
being passed solely from the async-iterator?I see in the
graphql-redis-subscriptions
that the async-iterator stores a list of the subscription ids and the event names, and then thesubIds
are mapped to the[triggername, onMessage]
pair in the pub-sub-engine. I'm confused about where and under which variables theonMessage
method is triggered.@davidyaha any insight would be appreciated.
The text was updated successfully, but these errors were encountered: