Search the docs or ask a question...

Delete a room

Update time: 2023/05/11 09:30:38

This topic describes how to delete a room in NERoom SDK. After the room is deleted, all members in the room are removed from the room.

Considerations

  • Rooms for live battles can survive for a maximum of 24 hours. The NERoom Server will automatically delete the rooms after 24 hours.
  • In other scenarios, a room can survive for a maximum of 16 hours. The NERoom Server will automatically delete the room.
  • To extend the default lifetime of a room, contact sales.
  • You can configure whether a role has the permission to delete a room in the CommsEase console. Only roles with this permission can delete rooms.

How it works

When a member delete a room, NERoom Server checks whether the member role has permissions for the operation based on the template ID and role ID. For example, if a member with a role ID of host deletes a room member, the following work flow verifies the required permissions.

Procedure

  1. Get the room context by calling getRoomContext. Set roomUuid to the ID of the room you want to join.
  2. Delete the room by calling the endRoom interface.
kt    fun endRoom(callback: NECallback<Unit>)
  1. After the room is deleted, the onRoomEnded callback method in the NERoomListener protocol will be triggered.
  • Example

Sample code for deleting a room:

ktNERoomService roomService = NERoomKit.getInstance().getService(NERoomService.class);
NERoomContext roomContext = roomService.getRoomContext(roomUuid);
if (roomContext!=null){
    roomContext.endRoom(new NECallback2<Unit>() {
        @Override
        public void onSuccess(@Nullable Unit unit) {
            super.onSuccess(unit);
            Log.d(TAG,"success");
        }

        @Override
        public void onError(int code, @Nullable String message) {
            super.onError(code, message);
            Log.d(TAG,"error");
        }
    });
}

API reference

Method Description
endRoom Delete a room.
Was this page helpful?
Yes
No
  • Considerations
  • How it works
  • Procedure
  • API reference