does not display the name of the server when you exit

0 votes
Hello.
I had a problem. Example Chat Server can not display the user name when you exit of the server. Help  me please. Engine -Corona SDK.
 
@Override
    public void onUserLeaveRequest(IUser user){
        System.out.println(user.getName() + " left room ");
    }
asked Jan 11, 2015 in AppWarpS2 by Fomin Kolaj (17 points)
Hi,
Are you not getting onUserLeaveRequest() or are you getting IUser null? What exactly do you mean by not able to displaye user name?
Thanks
Function on the server does not work. Does not display the departed person name. New user name is displayed in the server command line.
Hi,
I tried on my end and it is working perfectly fine. Can you give some more details about your project?
Is your RoomAdaptor getting attached properly? Can you share some more code snippets?
Thanks
In Example Chat Server-link:
https://s3-us-west-2.amazonaws.com/appwarps2/ChatDemo.zip
does not show the name of the user exit - screenshot №1
http://lokar.clan.su/img/1.png
when the user logs on, running - screenshot №2
http://lokar.clan.su/img/2.png
When a user disconnects from the network, the server does not show that the user has left - screenshot №3
http://lokar.clan.su/img/3.png
pressed the disconnect, the server has no reaction - screenshot №4
http://lokar.clan.su/img/4.png
---------------------------------------------------------
I installed the latest version of Java, latest version of apache ant 1.9.4.
Here describes the function "onUserLeaveRequest (IUser user)"
http://appwarps2.shephertz.com/dev-center/api-guide/adaptors/

/**
 * Invoked when a user leaves the room
 *  
 * @param user the user who is leaving the room
 */  
public void onUserLeaveRequest(IUser user)

but not working

1 Answer

+1 vote
 
Best answer
Hi,

I checked your code and found that there is actually no issue. The behaviour you are getting is perfectly normal and is supposed to work like this.

In Room Adaptor, onUserLeaveRequest is called when a user calls the leave room method. As the name suggests, onUserLeaveRequest is meant to handle users' leave room requests.

In your client side code, when you call "Disconnect" button, only disconnect() method is called. No request for leaveRoom() method is made. Therefore it will never call onUserLeaveRequest() in room adaptor.

Instead onUserRemoved of zone adaptor will be called as the user has left the Zone (i.e. Application).

Thanks
answered Jan 12, 2015 by Suyash Mohan (900 points)
selected Jan 12, 2015 by Fomin Kolaj
Thank you very much. You have helped me. But there is something.
In case of accidental disconnection of the player, the server does not know about this.
What can you recommend?
Whenever a user gets disconnected, you will get onUserRemoved  in Zone Adaptor
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 support@shephertz.com
...