# TCP Keep-Alive

## How Do I Keep the Connection Alive?

To keep your TCP connection to our server alive and avoid reconnecting, periodically send a request to the `/ping` endpoint.

***

### Strategy

The server supports persistent connections with a **keep-alive timeout of 65 seconds**. This means:

* If your connection is **idle** for more than 65 seconds, it will be closed.
* To keep it open, **send any request** before that timeout expires.
* Each connection can send a maximum of 1000 requests.

We recommend using the `/ping` endpoint:

`GET /ping`

This endpoint is lightweight, fast, and designed specifically to maintain your connection.

***

### Suggested Interval

Send a request to `/ping` **every 60 seconds** to keep the connection alive reliably.

```bash
while true; do
  curl -s https://nozomi.temporal.xyz/ping > /dev/null
  sleep 60
done
```

***

### Notes

* This is not a health check — it's just a way to prevent idle disconnects.
* Avoid pinging more often than needed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://use.temporal.xyz/nozomi/keeping-your-tcp-connection-alive.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
