nicolasdao / schemaglue

Naturally breaks down your monolithic graphql schema into bits and pieces and then glue them back together.
BSD 3-Clause "New" or "Revised" License
116 stars 13 forks source link

Apollo Subscription #2

Closed Dishant15 closed 6 years ago

Dishant15 commented 7 years ago

Does it support Subscription just like query and mutations ?

nicolasdao commented 7 years ago

Hi @Dishant15 ,

Not yet. I'll try to deliver this within a week. Hang on :)

Dishant15 commented 7 years ago

Hey thanks for the fast reply. I integrated your library in my project and all works like a charm, a huge thumbs up. That subscriptions update will make it The best.

Dishant15 commented 7 years ago

hi @nicolasdao , Any updates on the issue ?

nicolasdao commented 7 years ago

Sorry Dishant,

I'm very busy ATM. I'll try to do this this weekend.

On Wed, Sep 6, 2017 at 8:17 PM, Dishant Chavda notifications@github.com wrote:

hi @nicolasdao https://github.com/nicolasdao , Any updates on the issue ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nicolasdao/schemaglue/issues/2#issuecomment-327480073, or mute the thread https://github.com/notifications/unsubscribe-auth/ADRD9SevPvehuyZARR-H4VW9WINDv0K1ks5sfpt1gaJpZM4PFX0o .

--

Nicolas Dao

Managing Director at Neap Pty Ltd

Phone: +61420496277

Email: nic@neap.co

Website: https://neap.co

Address: Level 2, 1 Buckingham St, Surry Hills, 2010 NSW

Please, consider the environment before printing this e-mail

nicolasdao commented 7 years ago

Hi @Dishant15 ,

I've just added support for Apollo Subscription. I've tested it, and it's working for me. Can you please give it a shot?

Dishant15 commented 7 years ago

Hi @nicolasdao ,

So i upgraded schemaglue to @1.4.1 and tested with basic subscription schema. But i am getting this weird error on graphiql endpoint:

screen shot 2017-09-10 at 12 45 55 pm

I also tried with react apollo client and it also get same '[object] [object]' returned on subscribe and nothing else happens.. I am new to graphql and not sure if this is a schema problem or some other thing is wrong

nicolasdao commented 7 years ago

Thanks @Dishant15 , I will have a look at this asap

nicolasdao commented 7 years ago

Hi @Dishant15 ,

It's working just fine for me. If you want to see it in action, I've just created a demo project that hosts both a Test React web app and a GraphQL subscription that listens to that app here: https://github.com/nicolasdao/apollo-subscription-demo

Just follow the instructions and let me know if that makes sense to you (shemaglue is used in the server project in the server.js file).

Dishant15 commented 7 years ago

hi @nicolasdao ,

I cloned your project and it works perfectly! There are few things i don't understand though 1> Why use graphql-server-express instead of apollo-server-express as documentation says ? 2> In your graphQL schema you have added Mutations, Query and Subscriptions in one exports.query rather than separate exports for mutations and subscriptions as shown on schemaglue documentation here, is that the best approach ?

nicolasdao commented 6 years ago

Hi @Dishant15 ,

Sorry for the late reply. I forgot to answer you. I just find apollo a way better API as well as a better source of information. Plus, I really like the string approach to describe the schema. I find it way more readable. It is just a matter of personal taste. I spent most of my professional career using C# and I've become completely sick of the overhead of compiled languages. I know that TypeScript is really trendy these days, but for me, it is a step backward.

As for your 2nd question, I kept the example as short as possible for the sake of brevity. You're free to put the exports in different files if you want. That's the goal of SchemaGlue: Organize your schema the way you want. It makes sense that if your schema is very big, you might want to separate your mutation from your query. It depends on the circumstances.

Let me know if you need more details.

Cheers,

Nic