March 2018
Intermediate to advanced
304 pages
6h 59m
English
Now that we can create orders, we’re at the perfect spot to introduce the first basic subscription that will support pushing these orders as they’re created out to subscribed clients. You’ll first need to define a subscription field in your schema, and then you’ll also need a way to actually trigger this subscription when the :place_order mutation runs.
| | subscription do |
| | field :new_order, :order do |
| | |
| | config fn _args, _info -> |
| | {:ok, topic: "*"} |
| | end |
| | end |
| | end |
For the most part, this is a pretty ordinary-looking field. We’ve got another top-level object, subscription, to house our subscription fields, and then the :new_order, which ...
Read now
Unlock full access