# Events

The Player Elections REST API provides real-time interactions through events, allowing you to receive updates, notifications, and other important information dynamically. You can connect to these events using a WebSocket with basic authentication. Once connected, you will be able to listen to the events and receive the necessary information.

## Connecting

You can connect to the websocket just using the base URL of the API (Found in your servers documentation), and your server documentation should tell you if you need to connect with `wss` or `ws` (Secure or not secure). The socket will automatically listen to all events, and you can filter them on your end.

## Examples

You can view an example on how to connect to the websocket using Java and The [**Java-Websocket**](https://github.com/TooTallNate/Java-WebSocket) library [here](https://haste.olziedev.com/weyoyodaxi.csharp)

## Events

These events are sent through the WebSocket and can be listened to, these events are also referenced in the Plugin API as well. You can view an example of the event structure below that is sent through the WebSocket.


---

# Agent Instructions: 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:

```
GET https://docs.olziedev.com/projects/playerelections/restapi/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
