Skip to main content
Version: 5.7.0

GetSubscribedChannels

Returns a list of the channels of the specified type that the user has access to, with description info. Channel type can be one of "gl", "gr" or "all".

ServiceOperation
chatGET_SUBSCRIBED_CHANNELS

Method Parameters

ParameterDescription
channelTypeSpecifies the type of channels subscriptions to return. If empty string, returns channels of all types.

Usage

http://localhost:3000


string channelType = "all";
SuccessCallback successCallback = (response, cbObject) =>
{
Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
var channels = (Dictionary<string, object>[]) jsonData["channels"];

foreach (Dictionary<string, object> channel in channels)
{
string id = channel["id"].ToString();
string desc = channel["desc"].ToString();
string messageCount = ((Dictionary<string, object>)channel["stats"])["messageCount"].ToString();
string logMessage = string.Join(" | ", new [] {id, desc, messageCount});
Debug.Log(logMessage); // 22817:gl:CHAT_GLOBAL | General discussion about the app. | 25
}
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[GetSubscribedChannels Failed] {0} {1} {2}", status, code, error));
};
_bc.ChatService.GetSubscribedChannels(channelType, successCallback, failureCallback);
JSON Response
{
"data": {
"channels": [{
"id": "22817:gl:CHAT_GLOBAL",
"type": "gl",
"code": "CHAT_GLOBAL",
"name": "Global Chat",
"desc": "General discussion about the app.",
"stats": {
"messageCount": 25
}
},
{
"id": "22817:gl:CHAT_GROUPFINDER",
"type": "gl",
"code": "CHAT_GROUPFINDER",
"name": "Group Finder",
"desc": "Find a group.",
"stats": {
"messageCount": 25
}
},
{
"id": "22817:gr:134a78eb-ea90-4f4a-8fdd-87e5dad7c56c",
"type": "gr",
"code": "red",
"name": "red",
"desc": "",
"stats": {
"messageCount": 0,
"memberCount": 2,
"listenerCount": 0
}
}]
},
"status": 200
}
Common Error Code

Status Codes

CodeNameDescription
40601RTT_NOT_ENABLEDRTT must be enabled for this feature