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

Can I use this library to generate a graphql response payload? #252

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

Can I use this library to generate a graphql response payload? #252

zhaoyi0113 opened this issue Jan 18, 2023 · 0 comments

Comments

@zhaoyi0113
Copy link

Thanks for releasing this awesome library. I am looking for a way to generate graphql response payload from raw data.
What am doing is to take raw data from database and publish this data to subscribers via graphql subscription websocket. I have a schema like:

type Message {
  msg: String!
  id: ID!
  topic: String!
}

type Mutation {
  sendChat(topic: String!, message: String!): ID!
}

type Query {
  getChat(id: ID!): String!
}

type Subscription {
  # Subscribe to events on the given topic.
  event(
    # Name of the topic to subscribe to.
    on: String!
  ): Message!
}

when there is a need to publish Message data to subscribers, I will need to convert the raw data: { event: { msg: 'hello', topic: 'xxxx' } } to a payload the Apollo client expects.

Is there a way I can do that by using this library? The payload needs to include the __typename as well.

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