Angular HTTP vs HTTP native

I just find out that Ionic also provide a plugin called HTTP native. I’m using Angular HTTP and want know what is better to use. If anyone have any ideas, please share with me. I only work with Ionic for only two weeks.

One simple reason not to use the Ionic Native HTTP: It doesn’t work in ionic serve and non-Cordova deployments (PWA web app).

simple XHR works fine too…

I’ve tried both and here are the advantages of native HTTP:

a) It is actually faster when you make several simultaneous HTTP requests. You can do a test and see if for yourself.

b) Chrome limits the maximum simultaneous open connections to a domain to 6 (You can see chromium bugs archive for this - there has been an extended discussion on this and Google engineers have concluded 6 is more than you need). For most cases this is fine, but there are cases where this just doesn’t work (mostly due to legacy backend systems, like the system I am working with) - the only workaround is to create domain sharding/multiple ports/subdomains

c) Chrome recently decided to block basic authentication in URLs - this means HTTP URLs with basic username:password won’t work. Again, while its true that basic auth is not commonly used, many users still use basic auth for Apache routed LDAP auth. Try telling them the world has moved on.

d) I am not 100% sure of this, but I don’t think browser http supports SSL Pinning. The native plugin does

I am planning to migrate my app to use http native on devices and http browser for the desktop version of my app - I haven’t gotten around to writing that wrapper yet.

Thanks for your reply. I use Inonic for mobile only but I just get started so I think I may migrate to use HTTP native. Thanks again for your advice

To be honest, don’t use native unless you really have a need for it. Just know the limitations of the browser HTTP approach (and its benefits - which at the moment is that it will work in desktops/PWA too). Most apps being developed here that I see would probably not benefit from the native HTTP plugin. So decide based on your app (and your backend/API structure)

1 Like

angular http not working on ios as expected so using ionic native http it works on ios app. so better to use ionic native http instead of angular httpClient.

1 Like

What exactly is the problem? What do you mean by “not working as expected”?