I know the Firebase Realtime Database web SDK can use either WebSockets or long-polling to talk to the backend servers. Is there a way to force it to only use WebSockets?
In general, you don't want to do this since the Firebase SDK automatically detects whether the client supports WebSockets and will use them if possible. Since WebSockets don't work reliably in all browsers and in all environments (e.g. proxies occasionally don't reliably support WebSocket traffic), forcing WebSocket usage may cause your app to not work reliably in some situations.
As a diagnostic tool or to work around very specific issues, you can force the client to use WebSockets by changing your databaseURL to wss://<app>.firebaseio.com/
instead of https://<app>.firebaseio.com/
but if you find yourself needing to do this, it's probably worth reaching out to support to see if there's a better solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With