> ## Documentation Index
> Fetch the complete documentation index at: https://fivem.volkman.cz/llms.txt
> Use this file to discover all available pages before exploring further.

# Latent Events

> Detailed information about the latent events

As mentioned in the original documentation, there are several ways to call events within resources.
One particularly interesting approach is the use of latent events.
Although these are rarely utilized in practice, they can be highly beneficial. Let's go over how to work with them effectively.

## What are latent events?

This is a specific function used to transfer large amounts of data between the server and client.
As an example, if we need to send a substantial dataset (such as informations from a database or large server-sided dataset) to the client, we can use `TriggerLatentClientEvent`.
By leveraging latent events, the player's network remains unblocked, avoiding potential server kicks due to timeouts when receiving a large data load.

Latent events require a special parameter before specifying event arguments `bytes per second`, which controls the speed at which data is transmitted.

```lua theme={null}
TriggerLatentClientEvent(eventName, playerId, bytesPerSecond, argument1, argument2, ...)
```

This method is equally effective for sending data to the server from the client.

```lua theme={null}
TriggerLatentServerEvent(eventName, bytesPerSecond, argument1, argument2, ...)
```

<Warning>
  Note that the final event handler only triggers once all bytes have been
  transferred to the target destination and reconstructed into the event
  arguments. Therefore, the `bytes per second` value should be chosen
  carefully—not too high, which could overwhelm the network, nor too low,
  which could delay the event handler excessively.
</Warning>
