GetChannelInfo
Returns description info and activity stats for the specified channel. Note that numMembers
, numListeners
and listeners
are only returned for non-global groups. Only callable by members of the channel.
Service | Operation |
---|---|
chat | GET_CHANNEL_INFO |
Method Parameters
Parameter | Description |
---|---|
channelId | The id of the channel |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
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 name = jsonData["name"].ToString();
var desc = jsonData["desc"].ToString();
string logMessage = string.Join(" | ", new [] {name, desc});
Debug.Log(logMessage); // Trade Chat | Trade items here.
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[GetChannelInfo Failed] {0} {1} {2}", status, code, error));
};
_bc.ChatService.GetChannelInfo(channelId, successCallback, failureCallback);
const char *channelId = "55555:gl:bcDev";
_bc->getChatService()->getChannelInfo(channelId, this);
NSString *channelId = @"55555:gl:bcDev";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc chatService] getChannelInfo:channelId
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String channelId = "13229:gl:bcDev";
this; // implements IServerCallback
_bc.getChatService().getChannelInfo(channelId, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var channelId = "13229:gl:bcDev";
_bc.chat.getChannelInfo(channelId, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var channelId = "13229:gl:bcDev";
ServerResponse result = await _bc.chatService.getChannelInfo(channelId:channelId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var chatProxy = bridge.getChatServiceProxy();
var infoResult = chatProxy.getChannelInfo(channelId);
{
"service": "chat",
"operation": "GET_CHANNEL_INFO",
"data": {
"channelId": "55555:gl:bcDev"
}
}
JSON Response
{
"data": {
"id": "22817:gl:CHAT_TRADE",
"type": "gl",
"code": "CHAT_TRADE",
"name": "Trade Chat",
"desc": "Trade items here.",
"stats": {
"messageCount": 25
}
},
"status": 200
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40346 | CHAT_INVALID_CHANNEL_ID | The channel id provided is invalid. |
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |