Back

health

  • 0
  • Flutter
Jhalak_Upadhyay
6 Dec, 2023, 15:17

Using health endpoint in flutter.

I am currently contributing to an open source project and i need to check the status of the appwrite instance wether it is active or not but i am unable to access the health endpoint.

TypeScript
    try {
      final health = await getRealtime().health();
      print('Appwrite is active: ${health.status}');
      return health;
    } on AppwriteException catch (e) {
      print('Error checking Appwrite health: $e');
      throw e;
    }
  }```

> and i get this error :-
> The method 'health' isn't defined for the type 'Realtime'.
 if I am doing wrong then can you tell me how really to proceed.
TL;DR
OP is working on an open source project and needs to check the status of the appwrite instance. They are unable to access the health endpoint and getting an error message. The error is caused by the 'health' method not being defined for the 'Realtime' type. Solution: Define the 'health' method for the 'Realtime' type or find an alternative method to check the appwrite instance status.
Drake
6 Dec, 2023, 17:31

yes...that doesn't exist. Not sure where you saw that's available

Jhalak_Upadhyay
6 Dec, 2023, 17:33

So can you tell me what can I do actually the owner of the repository wants that I first that the appwrite instance is active then continue to the regular flow of the app otherwise show a error screen

Drake
6 Dec, 2023, 17:39

What repo?

Ernest
6 Dec, 2023, 17:39

He says he's contributing to an open source project

Ernest
6 Dec, 2023, 17:41

Pretty rudimentary but can you have a resource with global read which you can fetch on startup. Thus, if successfully fetched (appwrite instance is good) else otherwise

Jhalak_Upadhyay
8 Dec, 2023, 02:11

That is what I can do thankyou I will proceed this way only.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more