# Keeping the connection alive

To keep the connection alive, a <mark style="color:red;">`Ping`</mark> frame will be sent from the server every 20s, and a <mark style="color:red;">`Pong`</mark> is expected to be received from the client. If a `Pong` is not received within 60s, a <mark style="color:red;">`Close`</mark> frame will be sent and the connection will be closed.

If the server is shutting down, a <mark style="color:red;">`Close`</mark> frame will be sent and then a grace period of 20s will be given before the connection is closed. The client should reconnect after receiving the <mark style="color:red;">`Close`</mark> frame. The client will be reconnected to a server that is not shutting down.

{% hint style="success" %}
You will reveice below stream data every 60s:

`< Received ping (data: "hi")`
{% endhint %}


---

# 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://developer.1moneynetwork.com/integrations/websocket/keeping-the-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.
