Streaming is a feature where Fauna can push document changes as event notifications to database client code. The primary intended use case is for immediate user interface updates based on activity in your Fauna database.
Streaming is a much better alternative to the standard approach of polling. Polling is when client code repeatedly issues queries to the database at regular intervals. With pay-as-you-go pricing, polling is the much more expensive alternative, and your code is only aware of changes when query results are returned.
The polling diagram demonstrates that the client has to execute many more queries in order to discover when a document has been updated. For a streaming client, the subscription happens once and events are automatically broadcast to the client whenever the subscribed document is updated.
|There is a cost in compute operations to hold a stream open. See Billing for details.|
|Streaming works with HTTP/1.x, but HTTP/2 is much more efficient so use that if your client environment supports it.|
For the initial release of streaming, the following limitation exist:
Only 100 simultaneous streams per client app/browser.
Node.js clients are not currently supported.
Node.js' HTTP/2 implementation has an issue that currently prevents stream disconnections (and possibly other error conditions) from being reported correctly — no error event is triggered in these situations, so your client would wait for stream events that can never arrive.
A stream can be established only to a single user-created document. It is not currently possible to stream a schema document, such as for a collection, or index/set.
A stream only reports events to the fields and values within a document’s
No support for GraphQL subscriptions is available.
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
Thank you for your feedback!