
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Reliable internet connectivity, latency, and connection type for web apps. Works across WiFi, mobile data, and frameworks.
A lightweight library for detecting internet connectivity, measuring latency, and identifying connection types (WiFi, mobile data, ethernet) in web applications. Built to fix the common problem where libraries report "not connected" even when the user is online.
Netlytics validates connectivity with real HTTP probes instead of relying on unreliable browser APIs. It works consistently across WiFi and mobile data, providing accurate status updates for your users.
Many NPM connectivity libraries give wrong results:
navigator.onLine (true when on any network, even without internet)We believe connectivity detection should be reliable and accurate. Netlytics uses multiple probe URLs, configurable timeouts, and validates both online and offline events with real network requests — never trusting navigator.onLine alone.
Install Netlytics from your command line.
bun add netlytics
npm install netlytics
pnpm add netlytics
yarn add netlytics
Import the functions you need and start checking connectivity.
import {
checkConnectivity,
getConnectionType,
measureLatency,
watchConnectivity,
} from "netlytics";
// Check if the user is actually online (probe-based, not just navigator.onLine)
const result = await checkConnectivity();
console.log(result.online); // true | false
console.log(result.connectionType); // "wifi" | "cellular" | "unknown" | ...
console.log(result.latencyMs); // optional RTT from probe
// Get connection type hint (when supported by browser)
const type = getConnectionType(); // "wifi" | "cellular" | "ethernet" | "unknown"
// Measure latency in ms
const latency = await measureLatency();
console.log(latency); // number | null
// Live updates: both "online" and "offline" events are validated with a probe
const unsubscribe = watchConnectivity(
(result) => {
console.log(result.online ? "Connected" : "Disconnected");
},
{ observe: true } // default; set observe: false to disable
);
// later: unsubscribe();
A set of functions to help you build reliable connectivity detection without dealing with browser inconsistencies.
checkConnectivity(options?)Checks if the device has reachable internet by probing one or more URLs. Returns Promise<ConnectivityResult>:
online: boolean — Internet reachable (at least one probe succeeded)connectionType: ConnectionType — Best-effort: "wifi" | "cellular" | "ethernet" | "none" | "unknown"networkQuality: NetworkQuality — Best-effort: "slow-2g" | "2g" | "3g" | "4g" | "unknown"latencyMs?: number — RTT of the first successful probeOptions:
timeout — Timeout in ms per probe (default: 5000)requiredSuccesses — How many probes must succeed (default: 1)probeUrls — Custom URLs (must support CORS)getConnectionType()Returns ConnectionType from the Network Information API when available. Use for UX only; do not use as the only check for online/offline.
getNetworkQuality()Returns NetworkQuality from the Network Information API when available. Represents connection speed/quality (slow-2g, 2g, 3g, 4g).
measureLatency(options?)Measures round-trip time (latency) in ms by sampling requests to a reliable endpoint. Returns Promise<number | null> — average RTT in ms, or null if all samples failed.
Options:
timeout — Timeout per request (default: 5000)sampleSize — Number of samples (default: 3)watchConnectivity(callback, options?)Subscribes to online / offline events and validates each with a network probe (never relies only on navigator.onLine). Returns an unsubscribe() function.
Options (all optional):
observe — When true (default), listen and validate. When false, no listeners (manual checks only).debounceMs — Delay before probing after an "online" event (default: 400).offlineProbeTimeoutMs — Timeout when validating an "offline" event (default: 2000).onChecking — Called when a probe is about to run (e.g. to show "Checking…").ConnectivityOptions (timeout, probeUrls, etc.).A live demo is available to test Netlytics in the browser before installing:
Netlytics works with all popular JavaScript frameworks and vanilla JavaScript:
| React ✔ | Vue ✔ | Angular ✔ | Svelte ✔ | Vanilla JS ✔ |
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
To report a security vulnerability, please see SECURITY.md.
MIT License - see LICENSE file for details.
FAQs
Reliable internet connectivity, latency, and connection type for web apps. Works across WiFi, mobile data, and frameworks.
We found that netlytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.