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

Experimental support for subscription API ✨ #89

Merged
merged 2 commits into from
Sep 7, 2024

Conversation

ogaclejapan
Copy link
Contributor

@ogaclejapan ogaclejapan commented Sep 7, 2024

Implemented an API using Flow to subscribe to real-time data sources. The API is designed to receive real-time data unidirectionally, similar to GraphQL Subscriptions.

Use cases for this API include:

  • Receiving continuously provided sensor data from platform APIs, etc.
  • Monitoring changes in databases (such as Room or Firebase Realtime Database) and retrieving the updated data

Since the Subscription API is not directly related to the existing SWR (Stale While Revalidate) approach, it has been implemented separately as an experimental feature. To use this API, you will need to use SwrClientPlus instead of the SwrClient.

SwrClient SwrClientPlus
Features Query, Mutation Query, Mutation, Subscription
Implementation SwrCache + SwrCachePolicy SwrCachePlus + SwrCachePlusPolicy

Implemented an API using Flow to subscribe to real-time data sources.
The API is designed to receive real-time data unidirectionally, similar to GraphQL Subscriptions. (Bidirectional support will be considered at a later time.)

Use cases for this API include:

- Receiving continuously provided sensor data from platform APIs, etc.
- Monitoring changes in databases (such as Room or Firebase Realtime Database) and retrieving the updated data

Since the Subscription API is not directly related to the existing SWR (Stale While Revalidate) approach, it has been implemented separately as an experimental feature.
To use this API, you will need to use `SwrClientPlus` instead of the `SwrClient`.
@ogaclejapan ogaclejapan added the enhancement New feature or request label Sep 7, 2024
@ogaclejapan ogaclejapan merged commit a41b0b3 into main Sep 7, 2024
@ogaclejapan ogaclejapan deleted the experimental-subscription-api branch September 7, 2024 06:33
@github-actions github-actions bot mentioned this pull request Sep 8, 2024
ogaclejapan added a commit that referenced this pull request Sep 29, 2024
Currently, it is possible to explicitly delete in-memory data for queries through the `perform` function or the mutation
update process.

In #89, we added support for the Subscription API, but there is still no API available to clear in-memory data for subscriptions.
Therefore, we have implemented the `purgeAll` function, which is intended for full reset operations, such as during
sign-out processes.
@ogaclejapan ogaclejapan mentioned this pull request Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant