Channel¶
Channel creation¶
To create a new conversation channel, create a CreateChannelParams
object and then call the Chat class's createChannel()
method.
Createchannelparams¶
Field Name | Description | Type | Required |
---|---|---|---|
channelId | Channel ID (English letters, numbers, and some special characters ( - , . , _ , ~ , : ) allowed, up to 100 characters) | string | Y |
password | Password (Required field only for PRIVATE channels)(Up to 50 characters) | string | N |
channelName | Channel Name (Up to 50 characters) | string | Y |
maxMemberCount | Maximum number of channel participants (Minimum 2 to Maximum 5,000) | integer | Y |
type | Channel Type (PRIVATE , PUBLIC , GROUP ) | enum | Y |
The following is an example code for creating a new conversation channel.
using hive;
CreateChannelParams createChannelParams = new CreateChannelParams();
createChannelParams.channelId = "CHANNEL_ID";
createChannelParams.password = "";
createChannelParams.channelName = "CHANNEL_NAME";
createChannelParams.maxMemberCount = 8;
createChannelParams.type = ChannelType.PUBLIC;
Chat.createChannel(createChannelParams, (ResultAPI result) => {
if (result.isSuccess()) {
// API Call Success
}
});
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;
CreateChannelParams param;
param.channelId = "CHANNEL_ID";
param.channelName = "CHANNEL_NAME";
param.password = "";
param.maxMemberCount = 8;
param.type = ChannelType::PUBLIC;
Chat::createChannel(param, [=](ResultAPI const & result) {
if (result.isSuccess()) {
// API Call Success
}
});
import com.hive.Chat;
import com.hive.ResultAPI;
val params = Chat.CreateChannelParams(
channelId = "CHANNEL_ID",
password = "",
channelName = "CHANNEL_NAME",
maxMemberCount = 8,
type = Chat.ChannelType.PUBLIC
)
Chat.createChannel(params, object: Chat.CreateChannelListener{
override fun onResult(result: ResultAPI) {
if (result.isSuccess) {
// API Call Success
}
}
})
#import "HIVEService.h"
HiveChatCreateChannelParams* params = [[HiveChatCreateChannelParams alloc] init];
params.channelId = @"CHANNEL_ID";
params.password = @"";
params.channelName = @"CHANNEL_NAME";
params.maxMemberCount = 8;
params.type = Chat::ChannelType::PUBLIC;
[HiveChat createChannelWithCreateParams:params handler:^(HIVEResultAPI * result) {
if (result.isSuccess) {
// API Call Success
}
}];
Channel deletion¶
To delete an existing chat channel, call the Chat class deleteChannel()
method.
Here is an example code for deleting a conversation channel.
Channel entry¶
To enter the existing chat channel, create an EnterChannelParams
object and then call the Chat class's enterChannel()
method.
Enterchannelparams¶
Field Name | Description | Type | Required |
---|---|---|---|
channelId | Channel ID | string | Y |
password | Password (required for PRIVATE channels) | string | N |
Here is an example code for entering a conversation channel.
Channel exit¶
To exit the chat channel you participated in, call the Chat class exitChannel()
method.
This is an example code for exiting a conversation channel you participated in.
View all channel list¶
To retrieve the list of all currently existing channels, create a GetChannelsParams
object and then call the Chat class's getChannels()
method.
Note
If you do not pass the GetChannelsParams
object (passing null
if no object is provided), it returns the entire list of currently existing channels without filtering.
Getchannelsparams¶
Field Name | Description | Type | Required |
---|---|---|---|
type | Channel type (PRIVATE , PUBLIC , GROUP ) | enum | Y |
channelId | Retrieve channels starting with a specific channel ID | string | N |
channelName | Retrieve channels containing a specific channel name | string | N |
pageOrder | Sort order (ASC , DESC )(default DESC ) | string | N |
pageSize | Number of channels to retrieve per page (minimum 10 ~ maximum 100, default 10) | integer | N |
pageNumber | Page number to retrieve (starts from 1, default 1) | integer | N |
The Channel
object and the ChannelPage
object are provided as a response, and the structure is as follows.
Channel¶
Field Name | Description | Type |
---|---|---|
channelId | Channel ID | string |
type | Channel type (PRIVATE , PUBLIC , GROUP ) | enum |
owner | Channel owner's Hive PlayerID | string |
channelName | Channel name | string |
maxMemberCount | Maximum number of channel participants | integer |
regTime | Channel creation date and time (based on UTC+0 , format: yyyy-MM-dd'T'HH:mm:ss.SSSZ ) | string |
Channelpage¶
Field Name | Description | Type |
---|---|---|
size | Number of items per page | integer |
currentPage | Current page number | integer |
totalElements | Total number of items | integer |
totalPages | Total number of pages | integer |
The following is an example code to retrieve the list of all existing PUBLIC
type channels.
using hive;
GetChannelsParams getChannelsParams = new GetChannelsParams();
getChannelsParams.type = ChannelType.PUBLIC;
Chat.getChannels(getChannelsParams, (ResultAPI result, List<Channel> channels, ChannelPage channelPage) => {
if (result.isSuccess()) {
// API Call Success
foreach (Channel channel in channels) {
// Retrieve Channel
}
if (channelPage != null) {
// Retrieve ChannelPage
}
}
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;
Chat::GetChannelsParams params = Chat::GetChannelsParams();
params.type = Chat::ChannelType::PUBLIC;
Chat::getChannels(param, [=](ResultAPI const & result, std::vector<Channel> const & channels, ChannelPage const & pageInfo) {
if (result.isSuccess()) {
// API Call Success
for (Chat::Channel channel : channels) {
// Retrieve Channel
}
if (channelPage != null) {
// Retrieve ChannelPage
}
}
});
import com.hive.Chat;
import com.hive.ResultAPI;
val params = Chat.GetChannelsParams(type = Chat.ChannelType.PUBLIC)
Chat.getChannels(params, object: Chat.GetChannelsListener{
override fun onResult(
result: ResultAPI,
channels: ArrayList<Chat.Channel>,
channelPage: Chat.ChannelPage?
) {
if (result.isSuccess) {
// API Call Success
channels.forEach {
// Retrieve Channel
}
channelPage?.let {
// Retrieve ChannelPage
}
}
}
})
import com.hive.Chat;
Chat.GetChannelsParams params = new Chat.GetChannelsParams(Chat.ChannelType.PUBLIC, null, null, null, null, null);
Chat.getChannels(params, (result, channels, channelPage) -> {
if (result.isSuccess()) {
// API Call Success
for (Chat.Channel channel : channels) {
// Retrieve Channel
}
if (channelPage != null) {
// Retrieve ChannelPage
}
}
});
import HIVEService
let params = HiveChatParams.GetChannelsParams(type: .public, null, null, null, null, null)
ChatInterface.getChannels(getChannelsParams: params) { result, channels, pageInfo in
if result.isSuccess {
channels.forEach {
// Retrieve Channel
}
channelPage?.let {
// Retrieve ChannelPage
}
}
}
#import "HIVEService.h"
HiveChatGetChannelsParams* params = [[HiveChatGetChannelsParams alloc] init];
params.type = Chat::ChannelType::PUBLIC;
[HiveChat getChannelsWithGetChannelsParams:params handler:^(HIVEResultAPI * result, NSArray<HiveChatChannelContent *> * channels, HiveChatPageInfo * pageInfo) {
if (result.isSuccess) {
// API Call Success
for (Chat::Channel *channel : channels) {
// Retrieve Channel
}
if (channelPage != null) {
// Retrieve ChannelPage
}
}
}];
Channel information inquiry¶
To retrieve detailed information about a specific channel, call the Chat class's getChannelInfo()
method.
The response includes the Channel
object and the Member
object, and the structure is as follows.
Channel¶
Field Name | Description | Type |
---|---|---|
channelId | Channel ID | string |
type | Channel type (PRIVATE , PUBLIC , GROUP ) | enum |
owner | Channel owner's Hive PlayerID | string |
channelName | Channel name | string |
maxMemberCount | Maximum number of channel participants | integer |
regTime | Channel creation date and time (based on UTC+0 , format yyyy-MM-dd'T'HH:mm:ss.SSSZ ) | string |
Member¶
Field Name | Description | Type |
---|---|---|
playerId | Hive PlayerID | long |
extraData | Additional data (based on UTF-8 )(up to 256 Bytes) | string |
connectedTime | Connection time (based on UTC+0 , format yyyy-MM-dd'T'HH:mm:ss.SSSZ ) | string |
The following is an example code to retrieve detailed information about a specific channel.
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;
std::string channelId = "CHANNEL_ID";
Chat::getChannelInfo(channelId, [=](ResultAPI const & result, Channel const & channel, std::vector<Member> const & members) {
if (result.isSuccess()) {
if (channel != null) {
// Retrieve Channel
}
for (Chat::Member member : members) {
// Retrieve Member
}
}
});
import com.hive.Chat;
import com.hive.ResultAPI;
val channelId = "CHANNEL_ID"
Chat.getChannelInfo(channelId, object: Chat.GetChannelInfoListener {
override fun onResult(
result: ResultAPI,
channel: Chat.Channel?,
members: ArrayList<Chat.Member>
) {
if (result.isSuccess) {
channel?.let {
// Retrieve Channel
}
members.forEach {
// Retrieve Member
}
}
}
})
#import "HIVEService.h"
NSString *channelId = @"CHANNEL_ID";
[HiveChat getChannelInfoWithChannelId:channelId handler:^(HIVEResultAPI * result, HiveChatChannelContent * channel, NSArray<HiveChatMember *> * members) {
if (result.isSuccess) {
if (channel != null) {
// Retrieve Channel
}
for (Chat::Member *member : members) {
// Retrieve Member
}
}
}];
Channel member inquiry¶
To view the channel participating members, call the Chat class method getChannelMembers()
.
Note
The response value is the same as the Member
object passed from getChannelInfo()
.
Channel event management¶
Hive detects the connection status of the chat socket server and continuously delivers status change events occurring with app users and channels to the app. For detailed event handling methods, please refer to the Event Management > Channel Events document.