> For the complete documentation index, see [llms.txt](https://developer.aiodds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.aiodds.com/help-center/websocket/latency-in-websocket.md).

# Latency in WebSocket

## What is latency in WebSocket?

We provide the `uptime` field for each piece of data. Latency is the time difference between when you receive the data and the `uptime` value in that data.

{% code expandable="true" %}

```protobuf
message Outcome {
    ...
    uint32 uptime = 7; // update timestamp <level second>
    ...
}

message AiOdds {
    ...
    uint32 uptime = 6; // update time <level second>
    ...
}
```

{% endcode %}

## Is the latency normal?

It depends on the amount.

* If only some matches show latency, this can be expected and usually affects only a small portion of the feed. But this portion of delayed data will not account for a large proportion.
* If all matches show latency, it is abnormal. You need to check the following reason.

## Reason for WebSocket latency

The main reason for all matches occurring latency is due to untimely processing.

Currently, we push WebSocket data at a rate of 3000 records per second at peak time. If messages are processed too slowly, a backlog may occur and cause widespread latency.

#### Here is a detailed explanation:

WebSocket messages are sent sequentially, with the server continuously sending 3000 messages per second. If your consumer processes only 2,000 messages per second, the remaining 1,000 messages per second will accumulate as backlog. As a result, messages accumulate every second. We might send 30,000 messages in 10 seconds, while you might only be processing 20,000 messages, which will manifest as latency.

If you observe widespread latency, check whether your consumer is processing messages fast enough.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://developer.aiodds.com/help-center/websocket/latency-in-websocket.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
