Skip to main content

GetGroupChannelList

public BackendReturnObject GetGroupChannelList(string groupName);

Parameter

ValueTypeDescription
groupNamestringChannel group name to be searched

Description

Information of the chat channel group is called through the group name.
The chat channel group must be created in advance in BACKND Console > BACKND Chat > Chat Group Management, and the created channel group can be called in the console.

Channels are removed if there has been no user for 30 seconds. When a channel list is looked up, and an attempt is made to connect to a channel with no users after 30 seconds or more, an error will occur as the channel has been deleted.
In this case, call the channel list lookup method again to create a channel that can be connected.

Example

Synchronous

Backend.Chat.GetGroupChannelList(string groupName);

Asynchronous

Backend.Chat.GetGroupChannelList(string groupName, (callback) => 
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Chat.GetGroupChannelList, string groupName, (callback) => 
{
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200
message : Success returnValue : refer to GetReturnValuetoJSON

Error cases

When groupName is empty
statusCode : 404
errorCode : NotFoundException
message : Resource not found, Resource cannot be found

When the corresponding group name does not exist
statusCode : 404
errorCode : NotFoundException
message : Not found 'group name' group. not found, Not found 'group name' group cannot be found

When the chat service is deactivated
statusCode : 412
errorCode : PreconditionFailed
message : chat server is not available prerequisites are not met

GetReturnValuetoJSON

{
"groupName": "Operator only",
"rows": [{
"groupName": "Operator only",
"alias": "Bug feedback channel",
"inDate": "2021-01-13T01:14:30.263Z",
"maxUserCount": 200,
"joinedUserCount": 10,
"serverAddress": "ec2-3-36-74-178.ap-northeast-2.compute.amazonaws.com",
"serverPort": 50000
},
{
"groupName": string,
"alias": string,
"inDate": string,
"maxUserCount": number,
"joinedUserCount": number,
"serverAddress": string,
"serverPort": number
}, ...]
}

Sample code

public class ChatGroup
{
public string groupName;
public string alias;
public string inDate;
public int maxUserCount;
public int joinedUserCount;
public string serverAddress;
public ushort serverPort;

public override string ToString()
{
return $"groupName : {groupName}\n" +
$"alias : {alias}\n" +
$"inDate : {inDate}\n" +
$"maxUserCount : {maxUserCount}\n" +
$"joinedUserCount : {joinedUserCount}\n" +
$"serverAddress : {serverAddress}\n" +
$"serverPort : {serverPort}\n";
}
}
public void GetGroupChannelList()
{
string publicGroupName = "PublicAuto";

var callback = Backend.Chat.GetGroupChannelList(publicGroupName);

if(!callback.IsSuccess())
{
Debug.LogError($"{publicGroupName} Failed to load chat channel : {callback.ToString()}");
return;
}

LitJson.JsonData groupListJson = callback.FlattenRows();

List<ChatGroup> publicGroupsList = new List<ChatGroup>();

for(int i = 0; i < groupListJson.Count; i++)
{
ChatGroup chatGroup = new ChatGroup();

chatGroup.groupName = groupListJson[i]["groupName"].ToString();
chatGroup.alias = groupListJson[i]["alias"].ToString();
chatGroup.inDate = groupListJson[i]["inDate"].ToString();
chatGroup.maxUserCount = int.Parse(groupListJson[i]["maxUserCount"].ToString());
chatGroup.joinedUserCount = int.Parse(groupListJson[i]["joinedUserCount"].ToString());
chatGroup.serverAddress = groupListJson[i]["serverAddress"].ToString();
chatGroup.serverPort = ushort.Parse(groupListJson[i]["serverPort"].ToString());

publicGroupsList.Add(chatGroup);
}

string str = "Backend.Chat.GetGroupChannelList : \n";
foreach(var li in publicGroupsList)
{
str += li.ToString() + "\n";
}
Debug.Log(str);
}