Leave Chatroom
Leaving a chatroom with LM React Native Chat SDK allows you to exit a chatroom that you no longer want to be a part of.
Steps to Leave a Open Chatroom
- To leave a chatroom, use the method
followChatroom()
. - Pass in the required parameters
collabcardId
,uuid
andvalue
. - Process the response as per your requirement.
// To leave a chatroom, set the value to false
const payload: any = {
collabcardId: 89899, // your chatroom id
value: true,
uuid: 23233, // member uuid
};
const response = await lmChatClient?.followChatroom(payload);
if (response.success) {
// Update followStatus to false in local db as well
await lmChatClient?.updateChatroomFollowStatus(chatroomId, false);
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Leave Chatroom Payload
List of parameters for the followChatroom()
method.
Variable | Type | Description | Optional | |
---|---|---|---|---|
collabcardId | number | Chatroom Id | ||
uuid | string | Member Uuid | ✔️ | |
value | boolean | Follow value |
Leave Chatroom Response
List of parameters in the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |
Steps to Leave a Secret Chatroom
- To leave a secret chatroom use the method
leaveSecretChatroom()
. - pass in the required parameter
chatroomId
andisSecret
. - Process the response as per your requirement.
const payload: any = {
chatroomId: 89899, // Your chatroom ID.
isSecret: true,
};
const response = await lmChatClient?.leaveSecretChatroom(payload);
if (response.success) {
// Update followStatus to false in local db as well
await lmChatClient?.updateChatroomFollowStatus(chatroomId, false);
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Leave Secret Chatroom Payload
List of parameters for the function leaveSecretChatroom
.
Variable | Type | Description | Optional |
---|---|---|---|
chatroomId | number | Chatroom Id | |
isSecret | boolean | Set to true in case of secret chatroom | ✔️ |
Leave Secret Chatroom Response
List of parameters for the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |