graphql-playground icon indicating copy to clipboard operation
graphql-playground copied to clipboard

playground subscription doesn't listen with graphcool@next

Open miyi opened this issue 9 years ago • 10 comments

I started a graphcool@next project with the initial User and Post model. I want to listen to subscriptions in the playground for the creation of posts and users, but i get blanks. The same thing happens with all graphcool subscription tutorials as well (freedom, worldchat, instagram). screen shot 2017-10-19 at 3 40 57 pm

I hard coded subscription endpoint shows "subscribe is undefined". The above picture happens when I change the subscription endpoint to the real one as shown in the CLI. Is subscription in the playground broken at the moment?

miyi avatar Oct 19 '17 22:10 miyi

allposts show multiple posts created, but subscription listener is empty screen shot 2017-10-19 at 3 47 23 pm

miyi avatar Oct 19 '17 22:10 miyi

I can confirm it's also not working for me...

kbrandwijk avatar Oct 19 '17 22:10 kbrandwijk

Thanks for reporting! When clicking on the cog symbol, what does the subscription endpoint say?

On 20 Oct 2017 12:55 AM, "Kim Brandwijk" [email protected] wrote:

I can confirm it's also not working for me...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/graphcool/graphql-playground/issues/191#issuecomment-338060317, or mute the thread https://github.com/notifications/unsubscribe-auth/ABC0lFDbJzXOZVR4DCbyZDU-FROhYWHkks5st9NRgaJpZM4P_9um .

timsuchanek avatar Oct 20 '17 07:10 timsuchanek

@timsuchanek I got the same problem. Subscription endpoint was empty and I cannot typed anything on the input box. Well, I saw an improper web-socket was called on the network tab(inspect element). screen shot

v1.0.2,v1.1.1 on mac

Cerberus avatar Oct 21 '17 19:10 Cerberus

Came to see if someone else had this bug. I am on v1.0.2 on a mac, running a local deployment, and cannot change the subscription endpoint.

crubier avatar Oct 22 '17 22:10 crubier

Have this issue too.

joshhopkins avatar Nov 06 '17 11:11 joshhopkins

It seems it's a critical issue. /cc @timsuchanek

morajabi avatar Nov 07 '17 08:11 morajabi

The subscriptions endpoint now is being configured with graphql config. You can read more about that here: https://github.com/graphcool/graphql-config#specifying-endpoint-info

The workflow looks like this: Have a folder with .graphqlconfig file. Execute graphql playground, gc playground or prisma playground, all work the same. The according endpoint will be opened with subscriptions enabled.

If you have a prisma or graphcool project, you don't need to provide the endpoints by hand - they're deducted from the prisma.yml or graphcool.yml. You just need to provide an "extension" in the graphql config:

projects:
  my-db:
    extensions:
      prisma: prisma.yml
      graphcool: graphcool.yml

Let me know if you have any issues with this workflow. Reopen if this is not solving your issue. Thanks!

timsuchanek avatar Jan 18 '18 16:01 timsuchanek

@timsuchanek I'm having the same issue trying to test subscriptions through the prisma/examples/subscriptions example (https://github.com/graphcool/prisma/issues/1671)

.graphqlconfig.yml

projects:
  app:
    schemaPath: "src/schema.graphql"
    extensions:
      endpoints:
        default: "http://localhost:4000"
  database:
    schemaPath: "src/generated/prisma.graphql"
    extensions:
      prisma: database/prisma.yml

On the other hand, the graphql-yoga/subscriptions example works. It's implementation is slightly different, using Pubsub: https://github.com/graphcool/graphql-yoga/tree/master/examples/subscriptions

hoodsy avatar Jan 18 '18 20:01 hoodsy

Thanks for reporting @hoodsy ! Did you already try what @nilan suggested here? https://github.com/graphcool/prisma/issues/1671#issuecomment-358896690

timsuchanek avatar Jan 19 '18 10:01 timsuchanek