> For the complete documentation index, see [llms.txt](https://docs.proudnet.com/proudnet.eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.proudnet.com/proudnet.eng/proud_service/proudchat/download/c++.md).

# C++

Download the ProudChat C++ SDK from the GitHub link below.

## :open\_file\_folder: [C++ ProudChat SDK](https://github.com/Nettention/ProudChatSDK/tree/main/ChatClientSDK/CPlusPlus/ProudChat)

## Project settings

Copy the SDK file downloaded via git to the path of your root project and open the properties window for that project file in visual studio's solution explorer.

### 1.  ProudNet Header file

<figure><img src="/files/HSu31ZU7HNoFXwoYECMZ" alt=""><figcaption></figcaption></figure>

In the Properties window, under <mark style="color:orange;">C/C++</mark> -> <mark style="color:orange;">Additional Include Directory</mark> -> add an include folder from the path to the folder where ProudNet is installed.

### 2. Set the path to the library \<ProudNetClient.lib> directory

<figure><img src="/files/8sX39BJFS98Z1gzRjvDs" alt=""><figcaption></figcaption></figure>

In the Properties window, under <mark style="color:orange;">Linker</mark> -> <mark style="color:orange;">General</mark> -> add the Debug or Release folder in <mark style="color:orange;">lib / x64 / v140</mark> from the path to the folder where ProudNet is installed.

### 3. Set library \<ProudNetClient.lib> Dependencies

<figure><img src="/files/iAH4H4HhDWf4qUNce5Si" alt=""><figcaption></figcaption></figure>

In the Properties pane, under <mark style="color:orange;">Linker</mark> -> <mark style="color:orange;">Input</mark>, add the <mark style="color:orange;">ProudNetClient.lib</mark> file located in the library directory you added.

{% hint style="warning" %}
Set both the Debug and Release configurations.
{% endhint %}

### 4. Adding ChatClient

You can include ChatClient in your project by creating a ChatClient object and using it.

## ChatClient object

### - Creating

```cpp
using namespace Proud;

ProudChat::CChatClient* chatClient = new ProudChat::CChatClient();
```

### - ChatClient::Init

This is the part that initializes the ChatClient. The user must call the <mark style="color:orange;">Init</mark> function to connect to the server before using it.

<table data-full-width="false"><thead><tr><th width="100">Function Name</th><th width="320">Parameters</th><th>Description</th></tr></thead><tbody><tr><td>Init</td><td>The user's UUID provided by the <a href="https://console.nettention.com"><strong>Proud Console</strong></a>, the UUID of the project created by the user, the user's own UniqueID, an event to be called on a successful server connection, and an event to be called on a failed server login</td><td>The user writes this part as a function to connect ChatClient to the server. As parameters, it receives a string required for project initialization (<mark style="color:orange;">authUUID</mark>,  <mark style="color:orange;">projectUUID</mark>, <mark style="color:orange;">uniqueID</mark>) and two events to check whether login is successful or failed.</td></tr></tbody></table>

<br>

### - ChatClient::Disconnect

<table data-full-width="false"><thead><tr><th width="186">Function Name</th><th width="237">Parameters</th><th>Description</th></tr></thead><tbody><tr><td>Disconnect</td><td>-</td><td>Use when you want to disconnect with the chat server.</td></tr></tbody></table>

### - ChatClient::FrameMove

The ChatClient has to call <mark style="color:orange;">FrameMove</mark> on Update all the time.

### - Function

<table data-full-width="false"><thead><tr><th width="204">Function Name</th><th width="317">Parameters</th><th>Description</th></tr></thead><tbody><tr><td>IsConnected</td><td>-</td><td>Use when you check the status of server connection.</td></tr><tr><td>Join_Channel</td><td>Unique key for the channel you want to access</td><td>Use when you want to access a specific channel.</td></tr><tr><td>Leave_Channel</td><td>Unique key for the channel you want to leave</td><td>Use this when you want to leave the channel you're in.</td></tr><tr><td>Send_Direct_Msg</td><td>A unique identification value for a specific recipient, a message to send to the specific party</td><td>Use to send a message to a specific person.</td></tr><tr><td>Send_Channel_Msg</td><td>A unique identification value for a specific channel, a message to send to the specific channel</td><td>Use to send a message to a specific channel.</td></tr><tr><td>MsgTranslate</td><td><p>src = The country code of current language</p><p>target = The country code of the targeting language</p><p>msgKey = A unique key of message to translate</p><p>msg = A message to translate</p></td><td>(Beta) Use when you want to translate the message</td></tr><tr><td>MsgTranslate_Auto</td><td><p>target = The country code of the targeting language</p><p>msgKey = A unique key of message to translate </p><p>msg = A message to translate</p></td><td>(Beta) Request the translation of the message after automatically detecting the language.</td></tr><tr><td>MsgRecord_Channel</td><td>channelKey = A unique key of the channel<br>day = The days (max 90)<br>cnt = The counts (max 100)</td><td>(Beta) Request the chat data from the Channel. <br>Retrieve up to 100 messages within the last 90 days.</td></tr><tr><td>MsgRecord_Direct</td><td>target = A unique key of the target user<br>day = The days (max 90)<br>cnt = The counts (max 100)</td><td>(Beta) Request the data from the Direct messages.<br>Retrieve up to 100 messages within the last 90 days.</td></tr><tr><td>MsgRecord_Notice</td><td>day = The days (max 90)<br>cnt = The counts (max 100)</td><td>(Beta) Request the data from the Notice.<br>Retrieve up to 100 messages within the last 90 days.</td></tr></tbody></table>

### - Event variable

<table data-full-width="false"><thead><tr><th width="290">Event variable name</th><th>Description</th></tr></thead><tbody><tr><td>chatClientJoinCompleteDelegate</td><td>It will be called if the server successfully connects with the ChatClient.</td></tr><tr><td>chatClientDisconnectDelegate</td><td>It will be called if the server disconnects with the ChatClient.</td></tr><tr><td>chatClientJoinFailedDelegate</td><td>Variable will be called on server login failure.</td></tr><tr><td>channelMsg_ResponseDelegate</td><td>It handles events that occur if a <mark style="color:orange;">ChannelMsg</mark> arrives.</td></tr><tr><td>directMsg_ResponseDelegate</td><td>It handles events if the <mark style="color:orange;">Send-Msg</mark> arrives between users.</td></tr><tr><td>noticeDelegate</td><td>It will be called when you send <mark style="color:orange;">Notice</mark> from Proud Console.</td></tr><tr><td>channelJoinSuccessDelegate</td><td>It will be called if <mark style="color:orange;">Channel Join Success</mark> occurs.</td></tr><tr><td>channelJoinFailedDelegate</td><td>It will be called if <mark style="color:orange;">Channel Join Failed</mark> occurs.</td></tr><tr><td>channelLeaveSuccessDelegate</td><td>It will be called if <mark style="color:orange;">Channel Leave Success</mark> occurs.</td></tr><tr><td>channelLeaveFailedDelegate</td><td>It will be called if <mark style="color:orange;">Channel Leave Failed</mark> occurs.</td></tr><tr><td>msgTranslateSuccessDelegate</td><td>(Beta) It will be called if the message is successfully translated.</td></tr><tr><td>msgTranslateFailedDelegate</td><td>(Beta) It will be called if the message translation fails.</td></tr><tr><td>msgRecordSuccessDelegate</td><td>(Beta) It will be called if the data history is successfully retrieved.</td></tr><tr><td>msgRecordFailedDelegate</td><td>(Beta) It will be called if the data history retrieval fails.</td></tr></tbody></table>
