Page 1 of 1

How to check an user join Zone?

Posted: 06 Jan 2016, 16:20
by hoanghuybao
Hi admin,
I have some small queries:
How an user client can be notified if the other user join Zone? Or How to check a user is online? Which the API of smartFox support this?
Please help give your comment. :D

Cheer,

Re: How to check an user join Zone?

Posted: 07 Jan 2016, 09:23
by Lapo
Hello,
hoanghuybao wrote: How an user client can be notified if the other user join Zone?
Using the Buddy List API:
http://docs2x.smartfoxserver.com/Advanc ... y-list-api
Or How to check a user is online?
Again, using the buddy list each User can know the online status of all the people in his buddy list.

If you want to check for a specific User from the server side, you can use this code:
boolean isUserOnline = getParentZone().getUserManager().containsName("SomeUserName");
This will return true if the user with that name is logged in the server.
Which the API of smartFox support this?
You mean client API?
On the client side a User is only aware of the other Users in the Room(s) that he has joined. Also he can be aware of the status of the Users in the Buddy List.
If you want to check other Users that are outside this scope (joined Rooms + buddy list) you will need to ask the server via an Extension call.

The server will then check via the example I posted and send a reply to the client, if this is what you're looking for.

Cheers

Re: How to check an user join Zone?

Posted: 11 Jan 2016, 16:07
by hoanghuybao
Hi Lapo,

I appreciate your answer. It is very full :D. Thank you very much.

Cheer,