A demo of GraphQL subscriptions and "exploratory" @defer
and @stream
directives with Ruby on Rails.
This uses a WIP branch of graphql-ruby
and graphql-streaming
- Setup
- install Ruby 2.2 or greater
$ gem install bundler
(install Bundler, Ruby's package manager with)$ bundle install
(install this project's dependencies fromGemfile
)$ bundle exec rake db:create db:seed
(setup the database and add seed data)$ bundle exec rails server
(start the development server)$ open http://localhost:3000/
(visit the app)
- ActionCable transports
- Send GraphQL with ActionCable, Rails 5's new websocket library
http://localhost:3000/action_cable_transport
- Server: app/channels/graphql_channel.rb
- Client:
GraphQLChannel
fromgraphql-streaming
Transfer-Encoding: chunked
transport- Return
\n\n
-delimited chunks over a streaming HTTP response http://localhost:3000/chunked_transport
- Server: app/controllers/chunked_graphqls_controller.rb
- Client:
StreamingGraphQLClient
fromgraphql-streaming
- Return