# RoomConnections

This code defines a class called `RoomConnections`. This class is used to handle events related to network connections. In particular, it handles events such as room creation, joining, and leaving.

### Members

1. **Server Side Events**: This section defines events that may occur on the server side.
   * `OnServerCreateRoom`: The room creation process is triggered on the server.
   * `OnServerJoinRoom`: The process of joining the room is triggered on the server.
   * `OnServerExitRoom`: Triggered on the server to exit the room.
2. **Client Side Events**: This section defines events that may occur on the client side.
   * `OnClientRoomListAdd`: It is called from the client to add it to the room list.
   * `OnClientRoomListUpdate`: Called from the client to update the room list
   * `OnClientRoomListRemove`: Called from the client to delete from the room list
   * `OnClientConnectionMessage`: Called from the client to return the connection id
   * `OnClientCreatedRoom`: It is called from the client when the room is created
   * `OnClientJoinedRoom`: It is called from the client when it joins the room.
   * `OnClientRemovedRoom`: Called from the client when the room is deleted
   * `OnClientExitedRoom`: Called from the client when leaving the room
   * `OnClientFailedRoom`: It is called from the client when there is an error regarding the room.

### Methods

1. ```csharp
   AddRegistersForServer()
   ```
   1. This method records events to be used on the server side.
   2. For example, it causes the `OnReceivedRoomMessageViaServer` method to be run when the server creates a room.
2. ```csharp
   AddRegistersForClient()
   ```
   1. This method records events to be used on the client side.
   2. For example, it causes the `OnReceivedRoomMessageViaClient` method to be invoked when a client joins a room.
3. ```csharp
   OnRoomListChangeForClient()
   ```
   1. This method works when the room list changes on the client side.
   2. It triggers the `OnClientRoomListAdd` event if a new room is added, the `OnClientRoomListUpdate` event if the room is updated, and the `OnClientRoomListRemove` event if the room is removed.
4. ```csharp
   OnReceivedRoomIDViaClient()
   ```
   1. This method works when a connection message is received on the client side.
   2. Triggers the `OnClientRoomIDMessage` event.
5. ```csharp
   OnReceivedConnectionMessageViaClient()
   ```
   1. This method works when a connection message is received on the client side.
   2. Triggers the `OnClientConnectionMessage` event.
6. ```csharp
   OnReceivedRoomMessageViaServer()
   ```
   1. This method works when a room message is received on the server side.
   2. Triggers the relevant event based on the type of message.
7. ```csharp
   OnReceivedRoomMessageViaClient()
   ```
   1. This method works when a room message is received on the client side.
   2. Triggers the relevant event based on the type of message.


---

# 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://reflective-roommanager.gitbook.io/docs/user-manual/network/connection/roomconnections.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.
