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 fcl from '@onflow/fcl';_10_10fcl.ping();
Or import directly the specific function:
_10import { ping } from '@onflow/fcl';_10_10ping();
Usage
_26import * as fcl from '@onflow/fcl';_26_26// Simple ping to test connectivity_26try {_26 const response = await fcl.send([fcl.ping()]);_26 console.log('Access Node is reachable');_26} catch (error) {_26 console.error('Access Node is not reachable:', error);_26}_26_26// Use ping for health checks_26const healthCheck = async () => {_26 try {_26 await fcl.send([fcl.ping()]);_26 return { status: 'healthy', timestamp: new Date().toISOString() };_26 } catch (error) {_26 return {_26 status: 'unhealthy',_26 error: error.message,_26 timestamp: new Date().toISOString(),_26 };_26 }_26};_26_26const health = await healthCheck();_26console.log('Health status:', health);
Returns
_10export type InteractionBuilderFn = (_10 ix: Interaction,_10) => Interaction | Promise<Interaction>;
A function that processes an interaction object