Skip to main content
Version: 1.3.0

Installation and environment configuration

Download SDK

Note on BACKND Base SDK 5.11.9 or later

If you are using BackndChat-1.2.1 or later, BACKND SDK's version must be 5.11.9 or later.
If you are only using the chat function, please only import the SDK below.(All functions unavailable except login for BACKND Base)

Note on migration for 1.1.0 or earlier

If you are upgrading your version from BackendChat-1.1.0 or earlier to BackndChat-1.2.1 or above, delete the Assets > TheBackend > BackendChat folder and set the chat UUID again in the inspector.

Also, the namespace has been changed from BackendChat to BackndChat. Therefore, please change to 'using BackndChat;'.

Supported Platforms
  • Android, iOS, Windows, Mac(Editor), Linux

Enable chat

The following details the method to enable chat in the console:

1. Connect to the console.

2. Click Channel, Reports and Restrictions, or Settings under Chat.

3. Click the Enable Chat button.

Create chat channel

You can create a chat channel via Chat -> Channel in the console.

1. Click Channel.

2. Create channel groups and channels

  1. Click the + button next to Channel Groups.

  1. Enter the channel group name and the maximum number of users per channel. Then, select a FALLBACK channel and click Next.

  1. Enter the name of the first channel and click the Create button.

Installation and environment configuration

The following details the method to download the Chat SDK and configure a project in Unity:

  1. In Unity, click Assets > Import Package > Custom Package... menus in order.
  2. Load the 'BackndChat-x.x.x.unitypackage' file you have downloaded.
  3. Select all the files in the package and click the Import button.
  4. Save the project.

Setting Unity authentication values

To use chat in Unity, you must set the common server key and the chat server key.

  1. In BACKND Console, go to Chat > Settings tab and copy the common server key.

  1. Click The Backend > Edit Settings on the upper side of Unity. Then, enter the Client App ID and Signature Key in the created inspector.

  1. In BACKND Console, go to Chat > Settings tab and copy the chat server key (Chat UUID).

  1. Click The Backend > Edit Chat Settings on the upper side of Unity. Then, enter the Chat UUID in the created inspector.

SendLogReport

'Send Log Report' existing in the inspector is a value that determines whether additional logs are stored in the server when a request is sent to the server.
When an issue occurs, BACKND can track and analyze the cause via this log.

Using BACKND methods other than login

The Base SDK (Backend.dll) included in the Chat SDK only includes sign-up and login functions.

  • If you are already using the Base SDK and importing an SDK, exclude Backend.dll.
    If you are using an SDK version earlier than 5.11.1, please update it to 5.11.1 or a later version.
  • If you wish to use the Base's functions aside from the login function, import the BackendChat SDK and Base SDK ver. 5.11.1 or later to overwrite Backend.dll.

Log in to BACKND Base

Description

To use the chat's user management function, you must implement sign-up and login steps according to the process below:

Example

using BackEnd;
using UnityEngine;

public class LoginManager : MonoBehaviour
{
public InputField Username = null;

public InputField Password = null;

void Start()
{
Backend.Initialize(true);
}

void Login()
{
var returnObject = Backend.BMember.CustomLogin(Username.text, Password.text);
if (false == returnObject.IsSuccess())
{
Debug.Log("CustomLogin Fail");

returnObject = Backend.BMember.CustomSignUp(Username.text, Password.text);
if (false == returnObject.IsSuccess())
{
Debug.Log("CustomSignUp Fail");
return;
}

returnObject = Backend.BMember.CustomLogin(Username.text, Password.text);
if (false == returnObject.IsSuccess())
{
Debug.Log("CustomLogin Fail");
return;
}

// Nickname update - You cannot connect to the chat if you do not have a nickname.
Backend.BMember.UpdateNickname(Username.text);
}
}
}

Chat Client

Description

To receive changes and messages, you must implement certain callback methods in the application. It is defined with the IChatClientListener interface.

Features

One of our Chat SDK's features is the automatic reconnection process. When a user's network is changed or leased, the reconnection process is executed automatically. Because of automatic reconnection process, you do not have to manage the process separately as long as you proceed with the disposal when terminating the client after assigning ChatClient.

Example

public class UIChatManager : MonoBehaviour, BackEndChat.IChatClientListener
{
private BackndChat.ChatClient ChatClient = null;

void Start()
{
ChatClient = new ChatClient(this, new ChatClientArguments
{
Avatar = "default",
Metadata = new Dictionary<string, string>()
{
{ "Rank", "1" },
{ "Level", "1000" },
{ "Server", "Server 1" },
},
});

// If the inspector is not configured, you can register the Chat UUID (xxxx-xxxx-xxxxxx-xxxxxxx) as shown below.
/*
ChatClient = new ChatClient(this, new ChatClientArguments
{
UUID = "xxxx-xxxx-xxxxxx-xxxxxxx",
Avatar = "default",
Metadata = new Dictionary<string, string>()
{
{ "Rank", "1" },
{ "Level", "1000" },
{ "Server", "Server 1" },
},
});
*/

// If you are using a custom authentication server, you can register the token as shown below.
/*
ChatClient = new ChatClient(this, new ChatClientArguments
{
UUID = "xxxx-xxxx-xxxxxx-xxxxxxx",
Avatar = "default",
Metadata = new Dictionary<string, string>()
{
{ "Rank", "1" },
{ "Level", "1000" },
{ "Server", "Server 1" },
},
CustomAccessToken = USER_TOKEN,
});
*/
}

void Update()
{
ChatClient?.Update();
}

public void OnJoinChannel(ChannelInfo channelInfo) { }

public void OnLeaveChannel(ChannelInfo channelInfo) { }

public void OnJoinChannelPlayer(string channelGroup, string channelName, UInt64 channelNumber, PlayerInfo player) { }

public void OnLeaveChannelPlayer(string channelGroup, string channelName, UInt64 channelNumber, PlayerInfo player) { }

public void OnUpdatePlayerInfo(string channelGroup, string channelName, ulong channelNumber, PlayerInfo player) { }

public void OnChangeGamerName(string oldGamerName, string newGamerName) { }

public void OnChatMessage(MessageInfo messageInfo) { }

public void OnWhisperMessage(WhisperMessageInfo messageInfo) { }

public void OnTranslateMessage(List<MessageInfo> messages) { }

public void OnHideMessage(MessageInfo messageInfo) { }

public void OnDeleteMessage(MessageInfo messageInfo) { }

public void OnSuccess(SUCCESS_MESSAGE success, object param)
{
switch(success)
{
default:
break;
}
}

public void OnError(ERROR_MESSAGE error, object param)
{
switch(error)
{
default:
break;
}
}

private void OnApplicationQuit()
{
ChatClient?.Dispose();
}
}