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

Subscriptions Trigger with class based api? #2091

Closed
reaperdtme opened this issue Feb 6, 2019 · 2 comments
Closed

Subscriptions Trigger with class based api? #2091

reaperdtme opened this issue Feb 6, 2019 · 2 comments

Comments

@reaperdtme
Copy link

Following docs, trigger doesn't seem to work on our Schema:

class RelevntApiSchema < GraphQL::Schema

  mutation(Types::MutationType)
  query(Types::QueryType)
  subscription(Types::SubscriptionType)
end
RelevntApiSchema.subscriptions.trigger("communityChat", {community_id: community.id}, message)

We get:

undefined method `trigger' for nil:NilClass

Tried the following variations:

RelevntApiSchema.subscription.trigger("communityChat", {community_id: community.id}, message)
context.schema.subscriptions.trigger("communityChat", {community_id: community.id}, message)
@rmosolgo
Copy link
Owner

rmosolgo commented Feb 6, 2019

Hi, you also need a use ... line in your schema to add a Subscription implementation -- something that will take messages and transport them to clients.

For example:

Please reopen if you still have trouble after hooking one of those up!

@rmosolgo rmosolgo closed this as completed Feb 6, 2019
@reaperdtme
Copy link
Author

@rmosolgo didn't see use in the docs anywhere. have a connection now

GraphqlChannel is streaming from graphql-event::communityChat:communityId:Q29tbXVuaXR5LTE=

but it's misbehaving, any chance i could get some help getting this stream online? running it with react relay client side, and not getting any events. Relay complains it receives no data on subscription

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

2 participants