Skip to main content
Version: 5.7.0

GetChannelId

Retrieves a channel id given the specified lookup parameters.

ServiceOperation
chatGET_CHANNEL_ID

Method Parameters

ParameterDescription
channelTypeThe channel type - ‘gl’ for global, ‘gr’ for groups, ‘dy’ for dynamic.
channelSubIdThe type-specific sub id

Usage

http://localhost:3000


string channelType = "gl";
string channelSubId = "CHAT_TRADE";
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 channelId = jsonData["channelId"].ToString();

string logMessage = string.Join(" | ", new [] {channelId});
Debug.Log(logMessage); // 22817:gl:CHAT_TRADE
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[GetChannelId Failed] {0} {1} {2}", status, code, error));
};
_bc.ChatService.GetChannelId(channelType, channelSubId, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"channelId": "22817:gl:CHAT_TRADE"
}
}
Common Error Code

Status Codes

CodeNameDescription
40601RTT_NOT_ENABLEDRTT must be enabled for this feature
40603CHAT_UNRECOGNIZED_CHANNELThe sub id for the channel type is not recognized