# triggerLatentServerEvent (Client)

> Sends an event to the server bit by bit, in the background, at no more than `bandwidth` bytes a second. Meant for large data that must not hold up the rest of the traffic.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Events
- **URL**: https://wiki.mymp.gg/en/triggerLatentServerEvent

## Syntax

```lua
bool triggerLatentServerEvent(string eventName, element source, any ... [, int bandwidth = 5000, bool persist = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `eventName` | `string` | The event's name on the server. |
| `bandwidth` | `int` | Bytes per second, from 1. Anything over 128 KB a second counts as 128 KB. *(default: `5000`)* |
| `persist` | `bool` | Keep sending after this resource stops. With `false`, the transfer is cancelled when the resource stops. *(default: `false`)* |
| `source` | `element` | An element that exists on the server. |
| `...` | `any` | Arguments passed to the handlers on the other side: `nil`, booleans, numbers, strings, elements, vectors and tables of them. |

## Returns

`true` if the event was queued, `false` if there is no connection to a server, it is over 16 MB, or `source` or an argument is an element created only on this client.

Latent events to the same destination go out one at a time, in the order they were triggered. `getLatentEventHandles` gives each one's handle, to follow with `getLatentEventStatus` or stop with `cancelLatentEvent`.

## Example

```lua
local drawing = { width = 512, height = 512, strokes = {} }

triggerLatentServerEvent("onPlayerSaveDrawing", 20000, localPlayer, drawing)
```

### Note

The server only accepts the event if it registered it with `addEvent(eventName, true)`.

## See also

- [triggerServerEvent (Client)](https://wiki.mymp.gg/en/triggerServerEvent.md): Sends an event to the server, which triggers it on source there. The function returns before the server receives it.
- [getLatentEventHandles (Client)](https://wiki.mymp.gg/en/getLatentEventHandles-client.md): Lists the latent events this client is still sending to the server.
- [getLatentEventStatus (Client)](https://wiki.mymp.gg/en/getLatentEventStatus-client.md): Tells how a latent event this client is sending to the server is going.
- [cancelLatentEvent (Client)](https://wiki.mymp.gg/en/cancelLatentEvent-client.md): Stops a latent event this client is sending to the server. The server drops what it had received and the event is not triggered.
