How To Leave A Room

Leaving a room will raise OnLeave and the other members’ clients will raise OnMemberLeave if the leave was successful. We recommend your message include the sender's ID and other necessary information so that the recipients may detect which member has left  the room and behave accordingly.  If a UDP client is used, the message is sent as an RUDP.

 

NOTE: encoder shown here is an example and the client SDK does not include it.

messageData.SenderID = id;
messageData.Message = "Byte";
byte[] message = encoder.Encode(messageData); // This message will be sent to the other members when you leave the room successfully. Other members will receive the message via OnMemberLeave event
room.Leave(room.GetRoomID(), message);