# cancelLatentEvent (Client)

> Stops a latent event this client is sending to the server. The server drops what it had received and the event is not triggered.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Events
- **URL**: https://wiki.mymp.gg/en/cancelLatentEvent-client
- **Counterpart**: Also exists on the server, with its own implementation: [cancelLatentEvent (Server)](https://wiki.mymp.gg/en/cancelLatentEvent-server.md)

## Syntax

```lua
bool cancelLatentEvent(int handle)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `handle` | `int` | A handle from `getLatentEventHandles`. |

## Returns

`true` if it was cancelled, `false` if the handle does not exist or the transfer already finished.

## Example

```lua
addCommandHandler("cancelupload", function()
    for _, handle in ipairs(getLatentEventHandles()) do
        cancelLatentEvent(handle)
    end
end)
```

## See also

- [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.
- [triggerLatentServerEvent (Client)](https://wiki.mymp.gg/en/triggerLatentServerEvent.md): 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.
