Firebase with mobile apps

Is FireBase only for use in desktop browsers or can be used with mobile applications? I have a feeling that it cannot be used with a mobile phone (for now).

Although Android, for example, uses the WebKit engine (and its WebView component displays HTML pages without a full browser, and HTML pages can be loaded into the WebView either directly through the URL or entered as a string), Android WebKit is still (as far as I known) support for WebSockets, so if FireBase uses WebSockets (and I think I read somewhere), this excludes mobile applications (at least Android - I don't know about iOS).

Any other way to get real-time applications on mobile devices using FireBase? Thanks!

+6
source share
1 answer

Firebase supports all major mobile web browsers and even works offline. There is even a node.js client and a REST API .

It uses standard backup options when WebSockets are unavailable. Check out these FAQ questions :

What browsers and network connections does Firebase support? The Firebase JavaScript client supports all major browsers (IE 7+, Firefox, Chrome, Safari, Opera, and major mobile web browsers), and it works with any network connection. Our team has been building this type of software for many years, and we have done a lot of research and effort so that we can communicate in a wide variety of environments. We even work through proxies and on various mobile providers where other real-time technologies can work.

What happens with my application if I lose my network connection? Firebase transparently connects to Firebase servers as soon as you reconnect. In the meantime, all Firebase actions performed locally by your application will immediately trigger events regardless of network status, so your application will continue to work correctly. After reconnecting, you will receive an appropriate set of events so that your client โ€œcatches upโ€ with the current state of the server, without the need to write any user code.

Wait, does this mean that my application will automatically work in "offline mode" and recover after it goes online? Yes Yes.: -)

UPDATE Ah, there we are. I wandered around looking for an SO question in which the FB team answered directly, but my search was not in vain :

The Javascript Firebase client supports real-time bidirectional connection to the server. Under the covers, WebSockets are used whenever possible (which have no restrictions on Cross-origin) and returns to hidden iframe-jsonp lengthy polling in older browsers (which wraps cross-origin problems only query execution).

+12
source

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


All Articles