17#ifndef __HIVE_CHAT_H__
18#define __HIVE_CHAT_H__
34enum class ReactionType;
45class ReportMessageParams;
76class HIVESDK_DLLEXPORT
Chat {
79 typedef std::function<void(
ResultAPI const & result)> onResult;
80 typedef std::function<void(
ResultAPI const & result)> onCreateChannel;
81 typedef std::function<void(
ResultAPI const & result)> onDeleteChannel;
82 typedef std::function<void(
ResultAPI const & result)> onEnterChannel;
83 typedef std::function<void(
ResultAPI const & result)> onExitChannel;
84 typedef std::function<void(
ResultAPI const & result)> onBlockMember;
85 typedef std::function<void(
ResultAPI const & result)> onUnblockMember;
86 typedef std::function<void(
ResultAPI const & result)> onChannelTranslationSetting;
87 typedef std::function<void(
ResultAPI const & result)> onConnect;
88 typedef std::function<void(
ResultAPI const & result)> onDisconnect;
89 typedef std::function<void(
ResultAPI const & result, std::vector<std::string>
const & channelIds, std::vector<std::string>
const & failChannelIds)> onReconnect;
90 typedef std::function<void(
ResultAPI const & result, std::vector<Channel>
const & channels,
ChannelPage const & channelPage)> onGetChannels;
91 typedef std::function<void(
ResultAPI const & result,
Channel const & channel, std::vector<Member>
const & members)> onGetChannelInfo;
92 typedef std::function<void(
ResultAPI const & result, std::vector<Member>
const & members)> onGetChannelMembers;
93 typedef std::function<void(
ResultAPI const & result, std::vector<Channel>
const & channels)> onGetChannelsByUser;
94 typedef std::function<void(
ResultAPI const & result, std::vector<BlockMember>
const & blockMembers)> onGetBlockMembers;
99 typedef std::function<void(
ResultAPI const & result, ReactionType
const & reactionType)> onAddReaction;
100 typedef std::function<void(
ResultAPI const & result, ReactionType
const & reactionType)> onRemoveReaction;
101 typedef std::function<void(
ResultAPI const & result)> onReportMessage;
162 static void getChannelInfo(std::string
const & channelId, onGetChannelInfo listener);
196 static void deleteChannel(std::string
const & channelId, onDeleteChannel listener);
232 static void exitChannel(std::string
const & channelId, onExitChannel listener);
288 static void blockMember(int64_t blockPlayerId, onBlockMember listener);
322 static void translate(TranslateParams
const & params, onTranslate listener);
343 static void reportMessage(ReportMessageParams
const & params, onResult listener);
363 static void connect(std::string
const & extraData, onResult listener);
659 static void executeEngine(picojson::value jsonParam);
688enum class ReactionType {
713 std::string channelId;
719 std::string channelName;
727 int64_t regTimeMillis;
729 bool chatHistoryAllowed;
732 bool parse(picojson::value
const & json);
733 picojson::object toJson()
const;
734 std::string toString()
const;
737 void setTranslationEnabled(
bool enabled, Chat::onChannelTranslationSetting listener)
const;
738 void addReaction(std::string
const & messageId, ReactionType reactionType, Chat::onAddReaction listener)
const;
739 void removeReaction(std::string
const & messageId, ReactionType reactionType, Chat::onRemoveReaction listener)
const;
759 bool parse(picojson::value
const & json);
760 picojson::object toJson()
const;
773 std::string connectedTime;
775 int64_t connectedTimeMillis;
778 bool parse(picojson::value
const & json);
779 picojson::object toJson()
const;
792 std::string blockedTime;
794 int64_t blockedTimeMillis;
797 bool parse(picojson::value
const & json);
798 picojson::object toJson()
const;
810 std::string channelId;
812 std::string password;
814 std::string channelName;
820 bool chatHistoryAllowed;
822 std::string otherPlayerId;
825 picojson::object toJson()
const;
826 std::string toString()
const;
839 std::string channelId;
841 std::string channelName;
845 std::string pageOrder;
852 picojson::object toJson()
const;
853 std::string toString()
const;
864 std::string channelId;
866 std::string password;
869 picojson::object toJson()
const;
870 std::string toString()
const;
881 std::string channelId;
885 std::string extraData;
887 std::vector<int64_t> mentionedPlayerIds;
889 std::string replyMessageId;
892 picojson::object toJson()
const;
893 std::string toString()
const;
894 bool parse(picojson::value
const & json);
909 std::string extraData;
912 picojson::object toJson()
const;
913 std::string toString()
const;
914 bool parse(picojson::value
const & json);
929 std::string messageId;
934 picojson::object toJson()
const;
935 std::string toString()
const;
938class HIVESDK_DLLEXPORT TranslateParams {
941 std::string sourceLanguage;
942 std::vector<std::string> targetLanguage;
945 picojson::object toJson()
const;
946 std::string toString()
const;
949class HIVESDK_DLLEXPORT ReportMessageParams {
952 std::string channelId;
954 std::string messageId;
956 int64_t reporteePlayerId;
960 std::string reasonDetail;
962 ReportMessageParams();
963 picojson::object toJson()
const;
964 std::string toString()
const;
976 std::string channelId;
980 std::string timestamp;
982 int64_t timestampMillis;
985 bool parse(picojson::value
const & json);
996 std::string channelId;
1000 std::string timestamp;
1002 int64_t timestampMillis;
1005 bool parse(picojson::value
const & json);
1016 std::string channelId;
1018 std::string timestamp;
1020 int64_t timestampMillis;
1023 bool parse(picojson::value
const & json);
1035 std::string messageId;
1037 std::string channelId;
1041 std::string message;
1043 std::string timestamp;
1045 int64_t timestampMillis;
1048 bool parse(picojson::value
const & json);
1059 std::string messageId;
1063 std::string extraData;
1067 std::string message;
1069 std::string timestamp;
1071 int64_t timestampMillis;
1075 std::string translatedMessage;
1077 std::map<ReactionType, std::vector<int64_t>> reactions;
1079 std::vector<int64_t> mentionedPlayerIds;
1081 std::string replyMessageId;
1083 std::string replyMessage;
1085 std::string replyExtraData;
1088 bool parse(picojson::value
const & json);
1099 std::string messageId;
1103 std::string extraData;
1107 std::string message;
1109 std::string timestamp;
1111 int64_t timestampMillis;
1114 bool parse(picojson::value
const & json);
1125 std::string messageId;
1129 std::string message;
1131 std::string timestamp;
1133 int64_t timestampMillis;
1136 bool parse(picojson::value
const & json);
1147 std::string nextMessageId;
1149 std::string prevMessageId;
1150 std::vector<ChannelMessage> content;
1153 bool parse(picojson::value
const & json);
1163 std::map<std::string, std::string> translations;
1166 bool parse(picojson::value
const & json);
1176 std::string channelId;
1177 std::string messageId;
1182 bool parse(picojson::value
const & json);
1194 virtual void onEnteredMember(
EnteredMember const & member) = 0;
1196 virtual void onExitedMember(
ExitedMember const & member) = 0;
1198 virtual void onDeletedChannel(
DeletedChannel const & channel) = 0;
1202 virtual void onChannelMessage(
ChannelMessage const & message) = 0;
1204 virtual void onAddReaction(
Reaction const & reaction) = 0;
1206 virtual void onRemoveReaction(
Reaction const & reaction) = 0;
1220 virtual void onDirectMessage(
DirectMessage const & message) = 0;
1231 virtual void onDirectMessage(
DirectMessage const & message) = 0;
1233 virtual void onNoticeMessage(
NoticeMessage const & message) = 0;
1246 virtual void onConnectStarted() = 0;
1248 virtual void onConnectCompleted(
ResultAPI const & result) = 0;
1264 virtual void onReconnected(
ResultAPI const & result, std::vector<std::string>
const & channelIds, std::vector<std::string>
const & failChannelIds) = 0;
1267 virtual void onDisconnected() = 0;
1280 virtual void onCustomData(std::string
const & data) = 0;
1285class HIVESDK_DLLEXPORT Unique64 {
1288 static Unique64& getInstance();
1289 std::string generateKey();
1292 uint64_t last_timestamp_ms_;
1295 static const uint16_t MAX_SEQUENCE = 0xFFFF;
1298 uint64_t getCurrentTimestampMs();
1299 uint64_t waitUntilNextMillisecond(uint64_t current_ts_ms_ref);
1302template<
typename Key,
typename Value>
1303class ThreadSafeMap {
1305 std::map<Key, Value> map_;
1306 mutable std::mutex mutex_;
1309 ThreadSafeMap() =
default;
1310 ThreadSafeMap(
const ThreadSafeMap&) =
delete;
1311 ThreadSafeMap& operator=(
const ThreadSafeMap&) =
delete;
1312 void insert(
const Key& key,
const Value& value);
1313 Value get(
const Key& key)
const;
1314 bool contains(
const Key& key)
const;
1315 size_t erase(
const Key& key);
차단된 사용자 정보
Definition: HIVE_Chat.h:787
채팅 채널 정보
Definition: HIVE_Chat.h:710
채널 이벤트 리스너
Definition: HIVE_Chat.h:1191
채널 메시지 정보
Definition: HIVE_Chat.h:1056
채널 대화 이력 조회 파라미터
Definition: HIVE_Chat.h:922
채널 대화 이력 정보
Definition: HIVE_Chat.h:1144
채널 공지 메시지 정보
Definition: HIVE_Chat.h:1032
채널 조회 페이지 정보
Definition: HIVE_Chat.h:747
채널 메시지 전송 파라미터
Definition: HIVE_Chat.h:878
HiveChat provides essential features for smooth chatting in games, such as real-time,...
Definition: HIVE_Chat.h:76
연결 리스너
Definition: HIVE_Chat.h:1243
채널 생성 파라미터
Definition: HIVE_Chat.h:807
커스텀 데이터 리스너
Definition: HIVE_Chat.h:1277
삭제된 채널 정보
Definition: HIVE_Chat.h:1013
1:1 메시지 정보
Definition: HIVE_Chat.h:1096
1:1 메시지 리스너
Definition: HIVE_Chat.h:1217
1:1 메시지 전송 파라미터
Definition: HIVE_Chat.h:902
채널 입장 파라미터
Definition: HIVE_Chat.h:861
입장 멤버 정보
Definition: HIVE_Chat.h:973
퇴장 멤버 정보
Definition: HIVE_Chat.h:993
채널 목록 조회 파라미터
Definition: HIVE_Chat.h:834
채널 멤버 정보
Definition: HIVE_Chat.h:768
유저 대상 공지 메시지 정보
Definition: HIVE_Chat.h:1122
리액션
Definition: HIVE_Chat.h:1174
Definition: HIVE_ResultAPI.h:64
메시지 번역 결과
Definition: HIVE_Chat.h:1161
유저 이벤트 리스너
Definition: HIVE_Chat.h:1228
static void sendMessageWithDirectSendMessageParams(DirectSendMessageParams const ¶ms)
Send a 1:1 message Receives the recipient ID and message and sends the message to the corresponding ...
ChannelType
채팅 채널 타입 정보
Definition: HIVE_Chat.h:668
static void getChannelMembers(std::string const &channelId, onGetChannelMembers listener)
Get channel members Receives the channel ID and retrieves the list of members in the corresponding c...
static void removeConnectionListener(std::string const &uniqueKey)
Remove Connection Listener Remove the registered connection listener.
virtual void onReconnected(ResultAPI const &result, std::vector< std::string > const &channelIds, std::vector< std::string > const &failChannelIds)=0
static void addChannelListener(std::string const &uniqueKey, ChannelListener *listener)
Register Channel Listener Register a listener to receive channel events.
ReasonType
메시지 신고 사유
Definition: HIVE_Chat.h:698
static void exitChannel(std::string const &channelId, onExitChannel listener)
Exit channel Receives the channel ID and exits the corresponding channel.
static void disconnect(onDisconnect listener)
Disconnects the Chat Server Disconnects from the Chat Server.
virtual void onConnected()=0
static void getChannelsByUser(onGetChannelsByUser listener)
Get a list of channels the user is participating in.
static void reportMessage(ReportMessageParams const ¶ms, onResult listener)
Report a message Channel id, message id, message author, and report reason for the message can be sp...
static void unblockMember(int64_t blockPlayerId, onUnblockMember listener)
Unblock user Receives the user ID and unblocks the corresponding user.
static void removeChannelListener(std::string const &uniqueKey)
Remove Channel Listener Remove the registered channel listener.
static void removeUserListener(std::string const &uniqueKey)
Remove User Listener Remove the registered user event listener.
virtual void onReconnectStarted()=0
static void translate(TranslateParams const ¶ms, onTranslate listener)
Message translation request.
static void connect(onConnect listener)
Connects the Chat Server Attempts to connect to the Chat Server.
static bool isConnected()
Check the socket connection status Check if the socket is currently connected.
static void getBlockMembers(onGetBlockMembers listener)
Get a list of blocked users.
static void addCustomDataListener(std::string const &uniqueKey, CustomDataListener *listener)
Register Custom Data Listener
static void getChannels(GetChannelsParams const *params, onGetChannels listener)
Get channel list Retrieves a list of accessible channels.
static void enterChannel(EnterChannelParams const ¶ms, onEnterChannel listener)
Enter channel Receives the channel ID and connects to the channel.
static void deleteChannel(std::string const &channelId, onDeleteChannel listener)
Delete channel Receives the channel ID and deletes the corresponding channel.
static void connect(std::string const &extraData, onResult listener)
Connects the Chat Server (Deprecated) This method is no longer recommended and will be removed in fu...
static void blockMember(int64_t blockPlayerId, onBlockMember listener)
Block user Receives the user ID and blocks the corresponding user.
static void sendMessageWithDirectSendMessageParams(DirectSendMessageParams const ¶ms, onDirectSendMessage listener)
Send a 1:1 message Receives the recipient ID and message and sends the message to the corresponding ...
static void reconnect(onReconnect listener)
Reconnects to the Chat Server (Deprecated) This method is no longer recommended and will be removed ...
static void sendMessageWithChannelSendMessageParams(ChannelSendMessageParams const ¶ms, onChannelSendMessage listener)
Send a channel message Receives the channel ID and message and sends the message to the correspondin...
static void getChannelInfo(std::string const &channelId, onGetChannelInfo listener)
Get channel information Receives the channel ID and retrieves the information of the corresponding c...
SortType
채널 정렬 타입 정보
Definition: HIVE_Chat.h:681
static void removeDirectMessageListener(std::string const &uniqueKey)
Remove Direct Message Listener Remove the registered 1:1 message listener.
static void sendMessageWithChannelSendMessageParams(ChannelSendMessageParams const ¶ms)
Send a channel message Receives the channel ID and message and sends the message to the correspondin...
static void addUserListener(std::string const &uniqueKey, UserListener *listener)
Register User Listener Register a listener to receive user events.
static void addDirectMessageListener(std::string const &uniqueKey, DirectMessageListener *listener)
Register Direct Message Listener Register a listener to receive 1:1 messages.
static void createChannel(CreateChannelParams const ¶ms, onCreateChannel listener)
Create a channel Channel Name, Maximum Number of People, and Type can be specified.
static void addConnectionListener(std::string const &uniqueKey, ConnectionListener *listener)
Register Connection Listener Register a listener to receive the connection status of the Chat Server...
static void removeCustomDataListener(std::string const &uniqueKey)
Remove Custom Data Listener