Skip to main content

Follow/Unfollow Chatroom

Allows a user to follow or unfollow a specific chatroom. This function requires the chatroom ID, a UUID for the user, and a value indicating whether to follow or unfollow the chatroom. This function is only available for open chatrooms.

Steps to follow or unfollow a chatroom

  1. Create a FollowChatroomRequest object using the builder pattern.
  2. Call the followChatroom() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. Process the response LMResponse<NoData> to confirm whether the operation was successful or handle any errors.
let request = FollowChatroomRequest.builder()
.chatroomId("ENTER_CHATROOM_ID")
.uuid("ENTER_UUID")
.value(true) // Set to true to follow, false to unfollow
.build()

LMChatClient.shared.followChatroom(request: request) { response in
if response?.error == nil {
// Handle success
print("Successfully followed the chatroom.")
} else {
// Handle error
print("Error following the chatroom: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}

Models

FollowChatroomRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
chatroomIdStringID of the chatroom to follow or unfollow
uuidStringUnique identifier for the user following the chatroom
valueBoolSet to true to follow the chatroom, false to unfollow