To exit from the game, B can send leaveRoom request. When B calls leaveRoom and A has subscribed the room, A will receive onUserLeftRoom notification.
If your still getting issue, please check the following steps to troubleshoot:
A: Creates Room
A: Joins room
A: Subscribes Room
B: Joins room
B: Subscribes Room
Also confirm that listeners are added and callbacks are defined.
B will be removed from room if B has
-called leaveRoom API
-called disconnect API
-lost the internet connection
Note:- If you are connection resiliency feature then in third case B will be alive till recovery time is elapsed.
Let us know if you are still facing problems.