How to make Firebase Realtime database use WebSockets?

I know that the Firebase Realtime Web SDK SDK can use either WebSockets or long polling to talk to server servers. Is there a way to make it use only WebSockets?

+3
source share
1 answer

In general, you do not want to do this, because the Firebase SDK automatically determines whether the client supports WebSockets and will use them if possible. Since WebSockets do not work reliably in all browsers and in all environments (for example, proxies sometimes do not reliably support WebSocket traffic), forcing the use of WebSocket may cause your application to not work reliably in some situations.

As a diagnostic tool or for solving very specific problems, you can force the client to use WebSockets by changing the url database to wss://<app>.firebaseio.com/ instead of https://<app>.firebaseio.com/ , but if you you need to do this, it may be worth the support to see if there is a better solution.

+6
source

Source: https://habr.com/ru/post/1216644/


All Articles