Skip to content

isReachable

isReachable(serviceURL, options?): Promise<boolean>

Defined in: packages/synapse-core/src/sp/is-reachable.ts:33

Check whether a provider’s PDP API answers a ping.

GET /pdp/ping

Returns false instead of throwing when ping fails with an HTTP, network or timeout error. Still throws AbortError when the signal aborts, and rethrows any other error, such as an invalid service URL, so caller mistakes are not reported as an unreachable provider.

Parameter Type Description
serviceURL string The service URL of the PDP API.
options? OptionsType isReachable.OptionsType

Promise<boolean>

Whether the provider answered isReachable.OutputType

import * as SP from '@filoz/synapse-core/sp'

if (await SP.isReachable('https://pdp.example.com', { timeout: 5000 })) {
  console.log('provider is up')
}

Errors isReachable.ErrorType