Skip to main content

Function: checkConnectivity()

checkConnectivity(host: string, options: ConnectivityOptions): Promise<MonitorCheckResult>

Defined in: electron/services/monitoring/utils/nativeConnectivity.ts:356

Main connectivity check function that replaces ping.promise.probe

Parameters

host

string

Target hostname or IP address to check

options

ConnectivityOptions = {}

Configuration options for the connectivity check

Returns

Promise<MonitorCheckResult>

Promise resolving to MonitorCheckResult with connectivity status

Example

// Basic TCP connectivity check
const result = await checkConnectivity("google.com");

// HTTP connectivity check with custom timeout
const result = await checkConnectivity("https://api.example.com", {
method: "http",
timeout: 10000,
});

// TCP check on specific ports
const result = await checkConnectivity("example.com", {
method: "tcp",
ports: [443, 80],
timeout: 3000,
});

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Error if the connectivity check encounters an unexpected error