Chat server connection¶
The Hive SDK chat feature uses WebSocket communication with the Hive chat socket server. Therefore, to use the Hive SDK chat feature, you must first refer to the guide below to connect to the Hive chat socket server.
Connection request¶
To connect to a chat, call the connect
method of the Chat
class.
The following is an example code that requests a chat connection.
Warning
The Hive SDK chat feature can only be used by users (including guest accounts) who have logged in using the Hive SDK authentication feature and have been issued a PlayerID
.
Request Reconnection¶
If the chat socket server connection is disconnected due to network conditions, you can request a chat reconnection. If you request a reconnection within 10 minutes after the chat socket server connection is disconnected, it will automatically attempt to enter the channel you previously joined. As a result of the reconnection request, a list of channels that were successfully entered and a list of channels that failed to enter will be returned as a response.
When requesting a chat reconnection, call the reconnect
method of the Chat
class. The following is an example code requesting a chat reconnection.
Disconnection request¶
To disconnect the chat, call the Chat class's disconnect()
method. Below is an example code to disconnect the chat.
Note
The chat disconnect request is automatically executed when the app user account logs out.
Connection status check¶
Checks if the app user is currently connected to the chat. Calls the Chat class isConnected
method.
The following is an example code to check the chat connection status.
Connection event management¶
Hive detects the connection status of the chat socket server and continuously delivers status change events to the app. For detailed event handling methods, please refer to the Event Management > Connection Events document.