> For the complete documentation index, see [llms.txt](https://equ8.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://equ8.gitbook.io/documentation/integration-guide/polling-client-events.md).

# Polling client events

**Events must be polled often as possible, preferably every “game frame”.**

The client-side events are:

* `equ8_event_id_send_request`. EQU8 has data to send (same as server).
* `equ8_event_id_error`. An error occurred.

If we received a `equ8_event_id_send_request` event, EQU8 has data that should be sent to the server.

If we received a `equ8_event_id_error` event, an error was detected. This can be anything for an environmental problem to an internal error. It is recommended that the user is notified and the game is terminated. The error-code should always be saved for debugging purposes.

**EQU8 will NEVER send more than `256` (`0x100`) bytes in a single packet.**

{% tabs %}
{% tab title="C/C++" %}

```cpp
equ8_event_t data;
switch(equ8_client_poll_event(&data))
{
    case equ8_event_id_error:
    {
        print_equ8_status_code(data.error.code);
        break;
    }
    case equ8_event_id_send_request:
    {
        packet_equ8_data equ8{
            static_cast<uint8_t *>(data.send_request.payload),
            data.send_request.size };
        send_to_server(&equ8);
        break;
    }
}
```

{% endtab %}

{% tab title="C#" %}

```cpp
switch(equ8.client.poll_event(ev))
{ 
    case equ8.equ8_event_id.error:
        print_equ8_status_code(ev.get_error_event());
        break;
    case equ8.equ8_event_id.send_request:
    {
        packet_equ8_data equ8 = new packet_equ8_data(
            ev.duplicate_send_event());
        send_to_server(equ8);
    }
    break;
}
```

{% endtab %}
{% endtabs %}

## Closing the session

Ok, so the last thing left to do code-wise is to close the connection to the EQU8 Anti-Cheat servers when player is no longer in a game.

{% tabs %}
{% tab title="C/C++" %}

```cpp
equ8_client_close_session();
```

{% endtab %}

{% tab title="C#" %}

```csharp
equ8.client.close_session();
```

{% endtab %}
{% endtabs %}
