Code Monkey home page Code Monkey logo

Comments (7)

jkarlin avatar jkarlin commented on July 21, 2024

What purpose does the ConnectionType part of this API provide? What can I do with the information that a user is on WiFi vs cellular vs Ethernet? That information is completely useless to me as any of these connection types can be either metered or unmetered.

It allows websites to add preferences. Such as, "auto-play video on cellular connections".

from netinfo.

igrigorik avatar igrigorik commented on July 21, 2024

Metered / unmetered is separate and independent signal - e.g. both network types may be metered but user may prefer one vs the other for some type of functionality.

I would love to provide metered/unmetered signal to applications. The problem is, getting this reliably and in a cross-platform way is very tricky.

from netinfo.

eligrey avatar eligrey commented on July 21, 2024

I was asking what use is ConnectionType, because metered information cannot be determined.

auto-play video on cellular connections

Why should I get a different experience from someone on WiFi just because it is common (but not universal) to have metered cellular data? Your example is acting on an assumption that a certain connection type is metered. If you can't expose if a connection is metered with this API, people like @jkarlin are going to make websites that discriminate features (auto-playing videos, asset resolutions) based on my connection type.

My question for you is what possible use is ConnectionType for when you don't assume certain types of connections are metered? The API already exposes connection max speed, which I can use to default to lower quality video playback for example.

I can't think of a single use of ConnectionType that doesn't have to do with assuming some are metered. Please help me understand.

I have >100 Mbps unlimited/unmetered LTE from Verizon and slower, limited/metered WiFi from Comcast. Not all cellular connections are metered and slow.

from netinfo.

igrigorik avatar igrigorik commented on July 21, 2024

It's perfectly reasonable for an application to expose a user preference that modifies behavior based on ConnectionType. Whether the user toggles such setting because they're on metered connection is a completely separate concern, and one deferred to the user.

from netinfo.

eligrey avatar eligrey commented on July 21, 2024

@igrigorik How can you expect API users to use this API in the manner you suggest when even the official MDN demo of the NetInfo API assumes meteredness of some connections.

Notice how there's "wifi-only", "wifi and cellular-only", but no "cellular-only"? This user tried to follow your recommended usage of presenting it in settings and still forgot to include "cellular-only" because they probably assumed most cellular connections are metered, and most wifi connections are unmetered. That demo from MDN isn't sufficient for me with my metered wifi and unmetered cellular data.

Now think about random one-man dev teams working on websites. They're likely going to make the same mistakes or even just copy the options from the MDN demo.

I hope this helps illustrate my issue to you better. I think the max speed part of the NetInfo API can be beneficial, but ConnectionType is going to harm me because people are going to accidentally assume meteredness (even if they didn't intend to), which will affect their use of this API nonetheless.

from netinfo.

igrigorik avatar igrigorik commented on July 21, 2024

@eligrey good catch on MDN article -- I agree that it needs to be updated.

Re, "one man dev-teams": bad developers will always find a way to shoot themselves in the foot, regardless of team size, project, or API. However, that should not prevent good developers from building richer and better experiences for the users, and ConnectionType is a building block for such features.

from netinfo.

eligrey avatar eligrey commented on July 21, 2024

Ok then. I just hope that maybe 2-3 years from now, if the majority of websites end up abusing this feature in a manner against your recommendations, that the W3C re-evaluates its usefulness. If it ends up mostly being used as you intended, that will be great and I would definitely appreciate devs using the API correctly.

See you in 2-3 years.

from netinfo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.