@capgo/capacitor-network-diagnostics
Run native network diagnostics for URL reachability, TCP ports, WebSocket handshakes, speed, and packet loss
Overview
Section titled “Overview”Run native network diagnostics for URL reachability, TCP ports, WebSocket handshakes, speed, and packet loss
Start with getNetworkStatus() and the other core methods listed below.
Platform support
Section titled “Platform support”| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | Native |
| Android | Yes | Native |
| Web | No | Guard with Capacitor.getPlatform() |
Core Capabilities
Section titled “Core Capabilities”getNetworkStatus- Read the native connection type and platform network flags.testUrl- Check HTTP or HTTPS URL reachability with status code and latency.testPort- Open a native TCP socket to a host and port.testWebSocket- Validate aws://orwss://handshake.testDownloadSpeed- Measure native download throughput from your own test file endpoint.testPacketLoss- Estimate application-level packet loss with repeated TCP or HTTP probes.runDiagnostics- Run a combined diagnostic pass and return a compact issue list.
Raw ICMP ping is not consistently available to App Store and Play Store apps, so packet loss uses repeated TCP or HTTP probes.
Public API
Section titled “Public API”| Method | Description |
|---|---|
getNetworkStatus | Read the current native connection type and platform network flags. |
testUrl | Test whether an HTTP or HTTPS URL can be reached from native networking. |
testPort | Test whether a TCP host and port can be opened from native networking. |
testWebSocket | Test whether a WebSocket URL can complete its native handshake. |
testDownloadSpeed | Measure download throughput from a native HTTP request. |
testPacketLoss | Estimate application-level packet loss with repeated TCP or HTTP probes. |
runDiagnostics | Run several diagnostics and return a compact issue list. |
getPluginVersion | Return the native plugin version marker. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-network-diagnostics.