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.
source share