Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update OnlineStatusContext and Create ConnectivityBars Component with Network Quality #287

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gkatrakazas
Copy link
Member

This pull request introduces improvements to the handling and display of network connectivity status by navigator.connection.downlink within the application. It updates the OnlineStatusContext for better network status management and creates a new ConnectivityBars component to visually represent network quality.

@gkatrakazas gkatrakazas force-pushed the feat/connectivity-bars branch from 9d87280 to 37ccb55 Compare August 1, 2024 10:21
@gkatrakazas gkatrakazas requested a review from kkmanos August 9, 2024 10:01
@gkatrakazas gkatrakazas marked this pull request as ready for review August 9, 2024 10:03
return (
<OnlineStatusContext.Provider value={{ isOnline }}>
<OnlineStatusContext.Provider value={{ isOnline, connectivityQuality }}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably call this connectionQuality as it's shorter and easier to read and type, while not losing any meaning. 🙂

@gkatrakazas gkatrakazas marked this pull request as draft August 29, 2024 09:09
@gkatrakazas
Copy link
Member Author

gkatrakazas commented Aug 29, 2024

The current issue with this feature is that navigator.connection is only supported in Chrome-based browsers (refer to MDN documentation for more details). Given this limitation, I see the following potential solutions in non support navigator.connection cases:

  1. Restrict the feature to browsers that support navigator.connection: If the feature is not supported, default to displaying a full connection status without further analysis.
  2. Implement periodic polling: Send requests to Google (e.g., every 5 seconds) and estimate network quality based on latency. However, there is a concern about potential exceptions occurring after several attempts.
  3. Wrap each request and measure latency based on file size: This approach would involve tracking the latency of each request to gauge network quality.
  4. Combine approaches 2 and 3: Reduce polling intervals based on the most recent request's latency data, allowing for more adaptive and efficient monitoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants