HealthService
open class HealthService : @unchecked Sendable
Service for checking Horizon server health status.
The health endpoint provides information about the Horizon server’s operational status, including database connectivity and Stellar Core synchronization. Useful for monitoring and determining if the server is ready to handle requests.
Example usage:
let sdk = StellarSDK()
let response = await sdk.health.getHealthCheck()
switch response {
case .success(let health):
print("Status: \(health.status)")
case .failure(let error):
print("Health check failed: \(error)")
}
See also:
-
getHealth()AsynchronousChecks the health of the Horizon server. This endpoint returns information about the health status of Horizon, including whether it can connect to its database and Stellar Core, and whether Stellar Core is synchronized with the network.
The HTTP status code returned by this endpoint will be:
- 200 OK: if all health checks pass (database connected, core up, and core synced)
- 503 Service Unavailable: if any health check fails
Declaration
Swift
open func getHealth() async -> HealthCheckResponseEnumReturn Value
HealthCheckResponseEnum indicating success or failure
View on GitHub
Install in Dash