ping
A builder function that creates a ping interaction to test connectivity to the Flow Access Node.
The ping interaction is a simple way to test if the Flow Access Node is reachable and responding. This is useful for health checks, connectivity testing, and debugging network issues.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.ping()
Or import directly the specific function:
_10import { ping } from "@onflow/sdk"_10_10ping()
Usage
_22import * as fcl from "@onflow/fcl";_22_22// Simple ping to test connectivity_22try {_22 const response = await fcl.send([fcl.ping()]);_22 console.log("Access Node is reachable");_22} catch (error) {_22 console.error("Access Node is not reachable:", error);_22}_22_22// Use ping for health checks_22const healthCheck = async () => {_22 try {_22 await fcl.send([fcl.ping()]);_22 return { status: "healthy", timestamp: new Date().toISOString() };_22 } catch (error) {_22 return { status: "unhealthy", error: error.message, timestamp: new Date().toISOString() };_22 }_22};_22_22const health = await healthCheck();_22console.log("Health status:", health);
Returns
InteractionBuilderFn
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>