Fauna does not use server push. Fauna’s streaming protocol is inspired by (but not implemented with) Server Sent Events (SSE). Event streaming - Fauna Documentation
Similar to the SSE protocol, events are communicated over a text-based channel. Each event is formatted as a single-line JSON object. Unlike SSE, Fauna adds an additional line ending,
\r\n, to delimit payloads, which helps with JSON parsing when network middleware splits the event payload into multiple packets.
From the client’s perspective, it’s just a regular request that takes a long time to download all of the data.
- For “fetch” environments, like the browser or Cloudflare workers, we use the fetch API.
- In Node, we default to using the built-in
http2 module, but still make a standard POST request.
In both cases, the client and server keep the connection open so the server can continue to send additional packets of data all as a part of a single request.
So why does it not work for your customer?
That is an excellent question!
If the resource you are requesting a stream for doesn’t exist, then the stream will fail to start. Make sure that your customer is not trying to access any missing documents or Set that doesn’t exist.
Did the stream get started?
Seems like the stream is started but the client never gets the ‘snapshot’ event.
Does your customer receive the “start” event? The “start” event is what indicates that the request to open the stream was successful.
The “snapshot” event actually comes from a standard
Get(your_doc) FQL query, that is executed once the “start” event is received. The order of operations is
- Send a POST request to the streaming endpoint
- When the connection for the stream request is successfully made, the driver issues a “start” event. The driver also now sends a regular query to
Get your document.
- When the query to
Get your document returns, the driver issues a “snapshot” event with the result
- When the request receives data, and that data signals the end of a streamed event with the
\r\n delimiter, the driver issues a “version” event.
Do you know precisely what browser they are using? We only test against and support stable Chrome, Firefox, and Safari. Also IE 11, if you need that
If they are using an unsupported browser, that could be part of the issue.
If they are using a supported browser, I recommend opening a support ticket at support.fauna.com or by emailing firstname.lastname@example.org. Please have your customer capture a HAR file that includes the requests to open fauna streams and attach with the ticket. Generating a HAR file for troubleshooting – Zendesk help