You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
Is there a way to consume the DAPI Client API similar to a WebSocket with realtime updates? @KamuelaFranco mentioned WebSockets are the primary implementation in issue [EV-1204] WebSocket connections #21 .
If so, is there an example of a sample pattern to implement in Javascript, Java/Kotlin, etc?
WebSockets are now the primary connection mechanism. HTTP requests are a default fallback in the event of socket communication failure.
An example of this is a client that needs to listen for a specific document to be updated from the fetchDocuments call.
Use Case
A user has two apps, Dash Wallet for holding Dash, and a Dash Feature app that uses Dash for an awesome feature. Using Dash Feature requires Dash, and securely initiating a transaction.
In order to create a seamless experience the Dash Feature app adds a request to DAPI for the given user.
DashWallet has a WebSocket call to fetchDocuments listening for any inbound requests. Once a request is received they can verify/decline (similar to Venmo in the U.S.), using existing Dash Wallet authentication.
Dash Feature has it's own WebSocket in order to listen for the completion of the transaction, and carries out the intended feature.
It's not implemented yet but we are definitely planning to do that later.
Of course, you can make a PR 😉. We always welcome contributions.
It doesn't look like a big deal. It requires some updates in Drive:
Add server streaming gRPC endpoint: subscribeToDocuments.
Keep filters from consumers in memory. It might be event full-featured queries like fetchDocuments accepts.
In block execution process on transaction commit asynchronously test new documents against the filters and send them through the endpoint if a document is following to query filter.
We have a similar mechanism in DAPI SPV endpoints (subscribeToTransactionsWithProofs) but much more complicated.
I appreciate the invite to contribute to the code! If my co-founder and I use DAPI our next feature we'll be exploring this further and would love to add value to the codebase.
Question
An example of this is a client that needs to listen for a specific document to be updated from the
fetchDocuments
call.Use Case
fetchDocuments
listening for any inbound requests. Once a request is received they can verify/decline (similar to Venmo in the U.S.), using existing Dash Wallet authentication.Example from Firebase's Firestore Database
Firebase's Firestore client libraries implement this pattern as outlined in Get realtime updates with Cloud Firestore.
The text was updated successfully, but these errors were encountered: