Can a bad internet connection cause issues with websockets in Phoenix?

I am new to Phoenix keep but I keep hearing that there is an issue with websockets when you are on a bad internet - mostly mobile phones in cars, subway, trains, remote locations, etc.

Somebody also mention long-polling - is that a default setting?

What is your experience?

Also how does this affect when you want to use Phoenix for mobile iOS, Android apps via the API pipeline. Is it similar?

I am new to Phoenix, so sorry if those questions are dumb.

1 Like

These are all good questions!

  1. Phoenix does not require use of sockets (be it websockets or long-polling backend), so it degrades just like any MVC framework under poor network connectivity.

  2. If you do choose to use sockets, it degrades just like any other websocket-driven UX under poor network connectivity. Possibly better, because of the long-polling fallback, I don’t remember how that works out of the box.

  3. LiveView is a framework for building soft-realtime bi-directional UI experiences on top of sockets, so its performance characteristics fall into point 2. Note that LiveView is not required to build a Phoenix app, nor even recommended for the average use-case.

  4. If you are powering a mobile application via calls to a Phoenix API you are using standard MVC, so see point 1.

  5. If you’re curious, try running some simulations. Most browsers have good support for simulating network latency, and Phoenix even comes with special tooling for simulating socket latency in particular!

In general, Phoenix is a web framework, so degrades like any web framework when packets can’t get through. LiveView is a realtime UI framework, so degrades like any constant-connection application when packets can’t get through. Nothing unique to Phoenix: bad internet impacts access to web apps.