realtime icon indicating copy to clipboard operation
realtime copied to clipboard

Use fallback of http long-polling if firewall blocks websockets.

Open GaryAustin1 opened this issue 2 years ago • 14 comments

Feature request

Currently realtime only uses websocket protocol. In some situations a user's firewall (often corporate) might block websocket or a proxy might not work.
Firebase realtime database falls back to http long-polling if websocket will not connect. At a minimum this possibility should be documented so developers can show their users a warning on possible firewall issue. Firebase long-polling: https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Settings#optional-experimentalautodetectlongpolling A good link on Firebase handling of websockets/long-polling: https://github.com/firebase/firebase-js-sdk/issues/1674 Phoenix discussion on long-polling fallback: https://elixirforum.com/t/fall-back-to-longpoll-when-websocket-fails/23894

Discussion discovering a likely firewall issue: https://github.com/supabase/supabase/discussions/5856#discussioncomment-2349176

Describe the solution you'd like

Realtime should implement long-polling as a backup protocol.

Describe alternatives you've considered

Better documentation and user warning. Resort to timed polling of database which would be very inefficient.

Additional context

I don't know the extent of this issue, but at least one Supabase user/developer seems to have run into it and Firebase and Phoenix seem to at least consider it..

GaryAustin1 avatar Mar 13 '22 14:03 GaryAustin1