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 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 |
chatHistoryAllowed | Whether chat history retrieval is allowed | enum | N |
Here is an example code to create 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 "HiveChat.h"
FHiveCreateChannelParams CreateChannelParams = FHiveCreateChannelParams();
CreateChannelParams.ChannelId = TEXT("CHANNEL_ID");
CreateChannelParams.Password = TEXT("");
CreateChannelParams.ChannelName = TEXT("CHANNEL_NAME");
CreateChannelParams.MaxMemberCount = 8;
CreateChannelParams.Type = EHiveChannelType::Public;
FHiveChat::CreateChannel(CreateChannelParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& 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 conversation channel, call the Chat class deleteChannel()
method.
Here is an example code for deleting a conversation channel.
Channel entry¶
To enter the existing conversation 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.
#include "HiveChat.h"
FHiveEnterChannelParams EnterChannelParams = FHiveEnterChannelParams();
EnterChannelParams.ChannelId = TEXT("CHANNEL_ID");
EnterChannelParams.Password = TEXT("");
FHiveChat::EnterChannel(EnterChannelParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
if (Result.IsSuccess()) {
// API Call Success
}
}));
Channel exit¶
To exit the chat channel you participated in, call the Chat class's 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 |
sort | Channel sorting criteria (ChannelId , ChannelName , RegTime ) | enum | N |
pageOrder | Sorting method (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 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 |
memberCount | Current number of participating members | integer |
maxMemberCount | Maximum number of participants in the channel | integer |
regTime | Channel creation date and time (based on UTC+0 , format yyyy-MM-dd'T'HH:mm:ss.SSSZ ) | string |
regTimeMillis | Channel creation date and time (Unix Timestamp) | long |
chatHistoryAllowed | Whether channel history retrieval is allowed | bool |
query | Method for retrieving channel message history | method |
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 "HiveChat.h"
TOptional<FHiveGetChannelsParams> GetChannelsParams = FHiveGetChannelsParams();
GetChannelsParams->Type = EHiveChannelType::Public;
FHiveChat::GetChannels(GetChannelsParams, FHiveChatOnGetChannelsDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveChannel>& channels, FHiveChannelPage const & channelPage) {
if (Result.IsSuccess()) {
// API Call Success
for (const FHiveChannel& Channel : Channels) {
// Retrieve Channel
}
if (ChannelPage != nullptr) {
// 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 retrieval¶
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 |
memberCount | Current number of participating members | integer |
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 |
regTimeMillis | Channel creation date and time (Unix Timestamp) | long |
chatHistoryAllowed | Whether channel history can be queried | bool |
query | Method for querying channel message history | method |
Member¶
Field Name | Description | Type |
---|---|---|
playerId | Hive PlayerID | long |
connectedTime | Connection time (based on UTC+0 , format yyyy-MM-dd'T'HH:mm:ss.SSSZ ) | string |
connectedTimeeMillis | Connection time (Unix Timestamp) | long |
The following is an example code for retrieving detailed information about a specific channel.
#include "HiveChat.h"
FString ChannelId = TEXT("CHANNEL_ID");
FHiveChat::GetChannelInfo(ChannelId, FHiveChatOnGetChannelInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveChannel& channel, const TArray<FHiveMember>& members) {
if (Result.IsSuccess()) {
// API Call Success
if (channel != nullptr) {
// Retrieve Channel
}
for (const FHiveMember& Member : Members) {
// Retrieve Member
}
}
}));
#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 participant members, call the Chat class's getChannelMembers()
method.
Note
The response value is the same as the Member
object passed from getChannelInfo()
.
#include "HiveChat.h"
FString ChannelId = TEXT("CHANNEL_ID");
FHiveChat::GetChannelMembers(ChannelId, FHiveChatOnGetChannelMembersDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveMember>& members) {
if (Result.IsSuccess()) {
for (const FHiveMember& Member : members) {
// Retrieve Member
}
}
}));
Channel message history inquiry¶
Call the channel.query(ChannelMessageListQueryParams, ChannelMessageListQueryListener)
method to retrieve previous chat history.
Only channels with the property chatHistoryAllowed
set to true
can retrieve history.
Channelmessagelistqueryparams¶
Field Name | Description | Type | Required |
---|---|---|---|
size | The size of the message to be received (minimum 1 ~ maximum 50) | integer | Y |
index | The index string needed for additional queries. Leave blank for the first query | string | Y |
Channelmessagelistquerylistener¶
Field Name | Description | Type |
---|---|---|
hasNext | A flag indicating whether additional queries can be made | long |
nextIndex | The index string needed for additional queries | string |
content | An array of retrieved ChannelMessage objects | ChannelMessage |
using hive;
ChannelMessageListQueryParams queryParams = new ChannelMessageListQueryParams(10, "");
channel.query(queryParams, (ResultAPI result, ChannelMessageListQueryResponse response) => {
if (result.isSuccess() && response != null) {
foreach (ChannelMessage message in response.content) {
// channel message list
}
}
});
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;
ChannelMessageListQueryParams queryParams;
params.size = 10;
params.queryIndex = "";
channel.query(queryParams, [=](ResultAPI const & result, ChannelMessageListQueryResponse const & response) {
if (result.isSuccess()) {
for (auto message : response.message) {
// channel message list
}
}
});
import com.hive.Chat;
import com.hive.ResultAPI;
val queryParams = Chat.ChannelMessageListQueryParams(size = 50)
channel.query(queryParams, object : Chat.ChannelMessageListQueryListener {
override fun onResult(
result: ResultAPI,
response: Chat.ChannelMessageListQueryResponse?
) {
if(result.isSuccess && response != null) {
response.content.forEach {
// channel message list
}
}
}
})
import com.hive.Chat;
Chat.ChannelMessageListQueryParams queryParams = new Chat.ChannelMessageListQueryParams(50);
channel.query(queryParams, (result, response) -> {
if (result.isSuccess() && response != null) {
for (HiveChatChannelMessage message : response.getContent()) {
// channel message list
}
}
});
#import "HIVEService.h"
HiveChatChannelMessageListQueryParams *queryParams = [[HiveChatChannelMessageListQueryParams alloc] initWithSize:10 index:@""];
[channel queryWithParams:queryParams listener:^(HIVEResultAPI * result, HiveChatChannelMessageListQueryResponse* response) {
if (result.isSuccess() && response.content) {
for (HiveChatChannelMessage *message in response.content) {
// channel message list
}
}
}];
Channel automatic translation reception settings¶
You can set whether to receive automatic translations of messages from this channel.
The translated messages can be checked in the received ChannelMessage object.
Channel event management¶
The Hive chat socket server detects connection status and continuously delivers status change events occurring between app users and channels to the app. For detailed event handling methods, please refer to the Event Management > Channel Events document.