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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
serviceURL |
string |
The service URL of the PDP API. |
options? |
OptionsType |
isReachable.OptionsType |
Returns
Section titled “Returns”Promise<boolean>
Whether the provider answered isReachable.OutputType
Example
Section titled “Example”import * as SP from '@filoz/synapse-core/sp'
if (await SP.isReachable('https://pdp.example.com', { timeout: 5000 })) {
console.log('provider is up')
}Throws
Section titled “Throws”Errors isReachable.ErrorType