Message¶
The Hive chat feature supports channel message sending to send messages to channels the user participates in, and 1:1 message sending to send messages directly to specific individuals.
Channel message sending¶
To send a message to a channel that the user has participated in, create a ChannelSendMessageParams
object and then pass it as an argument to the Chat class's sendMessage()
method to call it.
Channelsendmessageparams¶
Field Name | Description | Type | Required |
---|---|---|---|
channelId | Channel ID to send the channel message | string | Y |
message | Message to send to the channel (up to 200 characters) | string | Y |
This is an example code that sends a message to the channels the user has participated in.
Channel message event management¶
The sent message can be received by the onChannelMessage
event handler of the addChannelListener
event. For more details on event handling, please refer to the Event Management > Channel Events document.
1:1 message sending¶
To send a direct message to a specific recipient, the user creates a DirectSendMessageParams
object and then passes it as an argument to the Chat class's sendMessage()
method.
Directsendmessageparams¶
Field Name | Description | Type | Required |
---|---|---|---|
toPlayerId | Hive player ID of the target user | long | Y |
message | Message to be sent to the channel (up to 200 characters) | string | Y |
The following is an example code for a user to send a direct message to a specific recipient.
1:1 message event management¶
Messages sent through 1:1 message transmission can be received via the addDirectMessageListener
event handler onDirectMessage
event. For detailed event handling methods, please refer to the Event Management > 1:1 Message Event document.