2
2

More than 5 years have passed since last update.

graphql-ruby + apollo2 + ActionCableでsubscription

Posted at

Railsでgraphqlサーバーを含めて完結させるのに手こずったので。
Railsを使って、Reactアプリを表示しつつ、ApolloでGraphqlに繋いで、さらにSubscriptionをも使いたい場合に参考にしてみてください。

サンプルrepo

躓いた点

  • ActionCableでインスタンス違い(rails s -d / rails c)からのbroadcastadapter: asyncではだめ
cable.yml
development:
-  adapter: async
+  adapter: redis
+  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/0" } %>
+  channel_prefix: compass_development

細かい内容

https://github.com/github0013/graphql_subscription_actioncable/commits/master
コミットログに走らせたコマンドも記載してます。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2