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

Who does the logic to add graphql spec fields on the payload like __typename? #262

Open
zhaoyi0113 opened this issue Jan 19, 2023 · 0 comments

Comments

@zhaoyi0113
Copy link

I am exploring this library and trying to understand more about graphql spec level. When the server calls publish, I can see it just pass the payload to subscribers via EmitEmitter. But the client side expects a payload which includes a wrapper of the published payload.

For example, if the publisher publishes a payload like:

{
  topic: "xx", message: ...
}

what the subscriber receive should be something like:

 data: {
   event: {
      topic: "xx", message: ..., __typename: ...
  ...

the data top level field is from graphql spec, every payload should be under it. The event is the operation name from graphql schema. The __typename is the type of the schema. I wonder how this logic get added to the response?

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