-
Notifications
You must be signed in to change notification settings - Fork 985
Description
This was discussed with @sampajano in #1674.
Background:
OnSnapshot listeners normally use websocket (I think), but if client is behind a proxy that doesn't support websocket, the sdk can use long polling instead. This can be configured with experimentalForceLongPolling and experimentalAutoDetectLongPolling, and the latter may soon be turned on by default.
My observation:
When there's no new change on the doc, after 30 seconds the server will respond "no change" to the long poll.

However, if the proxy happens to be AWS API Gateway, which happens to enforce a timeout of exactly 30 seconds, the poll result will be just a hair too slow to return in time:

The problem:
It's a benign error, but it bombards the console every 30 seconds, and the wording isn't so benign:

Proposal:
- Respond to long polls after 29 seconds instead of 30, for the sake of AWS API Gateway (low hanging fruit)
- or make it configurable (could be over engineering if nobody uses it)
Very easy to reproduce:
// good normal long polling without proxy:
initializeFirestore(app, {
experimentalForceLongPolling: true,
});
// with proxy in the middle:
initializeFirestore(app, {
host: `6i558xin74.execute-api.us-west-1.amazonaws.com`,
// ↑ my production-ready proxy, everybody feel free to use!!
experimentalAutoDetectLongPolling: true,
});More info:
No "server" header, indicating the proxy returned 503 to client before firestore server returned anything to proxy:

