> For the complete documentation index, see [llms.txt](https://redboard.gitbook.io/r-type-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://redboard.gitbook.io/r-type-1/server/room/chatmessage.md).

# ChatMessage

The ChatMessage class is a nested class inside the [Room](/r-type-1/server/room.md) class. It represents messages that was sent by players in the matchmaking lobby. Each ChatMessages is assigned to a player and contains a string. The ChatMessage object cannot be copied or moved.

## Public member functions

````cpp
```cpp
// Construct a new Chat Message object
ChatMessage(Room &room, u_int playerId, const std::string &message);
// Get the Time Stamp object
const std::chrono::system_clock::time_point &getTimeStamp() const;
// Get the Player Id object
u_int getPlayerId() const;
// Get the Message object
const std::string &getMessage() const;
```
````

## Member functions documentation

### Constructor

The constructor of the ChatMessage class.

```cpp
ChatMessage(Room &room, u_int playerId, const std::string &message);
```

#### Parameters

* `room`: A reference to the room where the chat message has been sent.
* `playerId`: The id of the player that sent this message.
* `message`: The string containing the message that has been sent.

### getTimeStamp

Returns the time when the message has been sent.

```cpp
const std::chrono::system_clock::time_point &getTimeStamp() const;
```

#### Returns

A `std::chrono::system_clock::time_point` const reference that stores the time.

### getPlayerId

Returns the id of the player that sent this message.

```cpp
u_int getPlayerId() const;
```

#### Returns

An `unsigned int` containing the player id

### getMessage

Returns a string containing the chat message that has been sent.

```cpp
const std::string &getMessage() const;
```

#### Returns

A `std::string` const reference that stores the message.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://redboard.gitbook.io/r-type-1/server/room/chatmessage.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.
