Open CoryBall opened 3 years ago
TypeGraphQL doesn't maintain docs of Apollo Server. TypeGraphQL is library agnostic, you can use GraphQL Helix, express-graphql
or whatever you want. I don't see any point of repeating the docs of Apollo Server about the complex subscriptions setup.
Is there a current timeline for resolving this? I
I'm not sure what you're asking for 🤔
I'm talking about this page in TypeGraphQL's docs showing how to use TypeGraphQL with Apollo to set up subscriptions, which no longer works.
It stil works, only with Apollo Server v2. All we can do is to: 1) Duplicate long apollo docs 2) Add info that it's for v2 3) Remove this chapter totally, let's people setup it by itself 4) Switch all examples and docs to GraphQL Helix or something else
Whatever ends up happening I'll continue to use TypeGraphQL, I don't think the Decorators and integration for subscriptions in resolvers are affected, and setting up a subscription server is not TypeGraphQL's job to baby users through. Thanks for the library!
@MichalLytek - What do type-graphql subscriptions not work with Apollo version 2 ? Is it something that can be fixed and if not why not ? And does this effect Apollo version 3 using graphql-ws ?
@AaronNGray It's been working with Apollo v2 for 3 years.
It also works with Apollo v3, I've recently upgraded one project: https://gitlab.com/tezgraph/tezgraph
@MichalLytek - Thanks, that is relieving to hear ! The code is highly abstracted compared to normal examples.
I dont see any use of @Subscrition in the code !
@AaronNGray TypeGraphQL has nothing in common with Apollo v2 or v3. It provides a graphql-js
compatible schema.
Apollo v3 changes requires only changes in Apollo Server setup. Completely 0 changes needed for your resolvers or @Subscribe
.
@MichalLytek - I put my issue over on https://github.com/MichalLytek/type-graphql/discussions/1018 as I don't use StackOverflow out of principle. The issue I am having is with the @Subscription code I think as it works as a normal subscriptions on both v2 and v3.
I'd recommend to just put a link to here: https://www.apollographql.com/docs/apollo-server/data/subscriptions/#enabling-subscriptions I was able to follow their instructions quite well.
Does anyone have an example of using graphql-ws with apollo server / typegraphql ? https://www.apollographql.com/docs/apollo-server/data/subscriptions/#the-graphql-ws-transport-library
Here we go :-
https://github.com/AaronNGray/fullstack-apollo-graph-ws-subscription-type-graphql-example
Hope this helps !
It uses this package I made on the client side :-
https://github.com/AaronNGray/apollo-client-graphql-ws https://www.npmjs.com/package/apollo-client-graphql-ws
Perfect - thank you!
On Tuesday, 21 December 2021, Steve Gentile @.***> wrote:
Perfect - thank you!
Not quite, there's a reasonable number of security holes in the used modules. I have not got round to looking at them properly.
-- Aaron Gray
Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and Computer Scientist.
Maybe a package.json file can be added here: https://github.com/MichalLytek/type-graphql/tree/master/examples/simple-subscriptions so that we know what version of apollo-server works with the example?
@voidcenter Examples uses dependencies from the root node_modules
, so see devDependencies
section of the main package.json
What about graphql-ws?
With Apollo-Server version 3 forward (NPM shows it released about 2 months ago), the base
apollo-server
package no longer includes a "batteries-included" subscription server. You have to switch to an integrated package likeapollo-server-express
and implement your own using thehttp
andsubscriptions-transport-ws
packages.The current documentation explaining how to set up a subscription server with express shows different configuration than previous versions for the base
new ApolloServer()
, throwing some obvious errors.Is there a current timeline for resolving this? I'm not sure how to go about fixing this myself with a PR, I was just wondering if this was already part of an upcoming release, or if it hasn't been noticed yet.