Issue with left room (Cocos2d-x)

0 votes
A create room.

B join room.

Then A or B disconnect internet or exit game, but onUserLeftRoom not call, and I can't remove player on screen. Please help me a solution.
asked Jun 22, 2015 in AppWarp by tienbao (16 points)
To get onUserLeftRoom notifications, A & B both must subscribe for that particular room. Please check once and if this is not the case, can you please share code snippets for each and every step you are doing?
When B exit game but not call disconnect() (or lost internet), A still see B exists in room, how to detect event to remove B from A screen?

1 Answer

0 votes

Hi Tienbao,

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.

answered Jun 26, 2015 by rajeev.etc (1,660 points)
I care the 3rd case, B lost the internet connection or exit app, how to detect event to remove B from A screen and what's method ?
When B lost the internet connection or exit app, A will get onUserLeftRoom, if he(A) has subscribed the room.
Thanks for your reply, but A couldn't get onUserLeftRoom although A has subscribed when B lost the internet :(
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on