Keep alive for an ARI application

I am trying to create a keep alive method to ensure Asterisk did not disconnect from my ARI application (Asterisk 13). I can call /applications and check my application is listed. The problem is that this method also returns all channels attached to the application, and on my system there are usually more then 500 concurrent calls. Calling this method each minute seems too expensive.

Do you have any better idea?

Thanks,
Eyal Hasson.

Well, I managed a simple solution where I check if the application is alive only if no event was received within last minute.

Could use iniittab or upstart conf file depending on your distro. If the program dies, it will be automatically restarted.

I am not sure I understand your suggestion - I was looking for a way to know when the web socket connection of my ARI application to asterisk has unexpectedly closed. Currently what I found working is whenever a minute passes without any event, I invoke /applications/my_ari_application to see it is still connected.

My mistake. I was thinking that you wrote a separate program, which needs to be running, and that program was killing itself off. I see now.