Feature Request: Event-based subscriptions
See original GitHub issueReopen of #1355 .
To inspect whether it is good to use event-based subscriptions or live queries, I’ve gone through many articles and found this comment best describes the current state of live queries and event-based subscriptions.
There are still use cases of event-based subscriptions, especially when performance count more than reliability (take an example of twitter like subscription)
Another thing is that, most subscriptions in the current graphql ecosystem use event-based ones. It will be hacky to convert an existing project with subscriptions to hasura.
The hacky part of using live query for event-based subscriptions is that
- It will be difficult or at least not straight-forward to detect row deletion. #1201
- It will yield unnecessary initial results.
- Tracking
update
orcreate
events need extra effort (adding updated_at columns to sort with, etc.)
cc: @coco98
Issue Analytics
- State:
- Created 4 years ago
- Reactions:28
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Feature: Webhook Subscriptions - Laboperator
Webhook Subscriptions enable the receiving of push notifications on specific events as an HTTP POST request to a pre-set URL in Laboperator.
Read more >Event Subscriptions (Oracle Workflow Developer's Guide)
You can improve performance by specifying Key as the rule data for subscriptions that do not require the complete event data. For locally...
Read more >Event subscription best practices | Adobe Workfront
Provide all required request body fields · Avoid including extra body fields · Complete testing within the grace period · Meet the Standard...
Read more >Getting started with subscriptions - IBM Cloud Docs
Applications can subscribe to multiple event producers, but only one app can receive events from each subscription. Note that subscriptions can affect how...
Read more >Activate Event-Based Component | Stoplight Platform API Docs
In order to bill your subscribers on your Events data under the Events-Based Billing feature, the components must be activated for the subscriber....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@0x777
The problem with live queries is that they always deliver all the information.
Say I have a table with 10’000 records. One of them changes. So the live query fires. Now my application needs to find out which record changed in order to update it client side. So it has to compare all 10’000 records!
If event based subscriptions existed, the client could:
This seems so obvious I am sure I must have missed something essential. What have I missed?
One thing I’ve found is, it is very hard to write a mutation that would optimistically update a subscription with apollo, or maybe even impossible, since apollo doesn’t seem to have build in mechanisms to automatically update subscriptions (using optimisticResponse) and there is no possibility to read/write subscriptions from/to cache. This must be due to the fact that, as @heyrict states, most implementations and even apollo docs use event based subscriptions instead of live queries.
Would love to see some workaround for live-queries + optimistic response, I couldn’t manage to get this combination to work with apollo.