API Reference / API Methods / Keep alive

Keep alive

Keep alive is activated by default.

Because of the nature of keep alive connections, your process will not exit even if you don’t perform any further operations. We expose a client.destroy() method that terminates all remaining alive connections:

1
2
3
4
5
6
const client = algoliasearch('YourApplicationID', 'YourAdminAPIKey');
const index = client.initIndex('your_index_name');

const results = await index.search('query string');

await client.destroy();

You should call this method when you are finished working with the AlgoliaSearch API, so that your process exits properly.

Keep alive is always activated in browsers.

Did you find this page helpful?

JavaScript v4