Skip to content

@capgo/capacitor-network-diagnostics

Run native network diagnostics for URL reachability, TCP ports, WebSocket handshakes, speed, and packet loss

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.

PlatformSupportNotes
iOSYesNative
AndroidYesNative
WebNoGuard with Capacitor.getPlatform()
  • 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 a ws:// or wss:// 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.

MethodDescription
getNetworkStatusRead the current native connection type and platform network flags.
testUrlTest whether an HTTP or HTTPS URL can be reached from native networking.
testPortTest whether a TCP host and port can be opened from native networking.
testWebSocketTest whether a WebSocket URL can complete its native handshake.
testDownloadSpeedMeasure download throughput from a native HTTP request.
testPacketLossEstimate application-level packet loss with repeated TCP or HTTP probes.
runDiagnosticsRun several diagnostics and return a compact issue list.
getPluginVersionReturn the native plugin version marker.

This reference is synced from src/definitions.ts in capacitor-network-diagnostics.