Notification not received on client for user joined room

0 votes

Server: I have a zone rpc method that search for a suitable room for the user that made the call (I send the username as parameter) and add the user to the room.

On server I have this inside the rpc method:

room.addUser(user, true);

I checked and the user is added to the room.

The problem is that on client side I never receive the notification that the user joined a room. I receive the response that the rpc call was ok but no notification for the join room event.

I added this (I use Corona SDK on client side):

   appWarpClient.addNotificationListener("onUserJoinedRoom", scene.onUserJoinedRoom)  
 
but the onUserJoinedRoom method is never called. I also made a little debug on client side and I get no data from the server.
 
Am I doing something wrong or it this a bug?
 
Andrei
asked Sep 20, 2015 in AppWarpS2 by amarkovits (25 points)

1 Answer

0 votes
 
Best answer

Hi,

If you are adding a user in Room using Zone RPC API, in that case all the users those have already joined, will get a notification in  onUserJoinedRoom function.

Let me know if it helps.

Thanks & Reagrds

Vishnu Garg

answered Sep 21, 2015 by Vishnu Garg (674 points)
selected Sep 22, 2015 by amarkovits
ok, I understand. In this case I will send a message to the user I added to the room so that he know that he joined a room.

What I'm doing is to implement a custom matchmaking (based on some params, and also on time, etc) and I'm implementing it this way:

- user make a zone rpc call telling the server that he is ready to play
- when the server found a match for the user (that can happen also in the rpc call) the user is added to a room. I was hoping that for this action I will get a onUserJoinedRoom notification on the client but now I understand this notifications is received only for other users, not for myself. So I will have to send a message to the user notifying him that he joined a room.

Is there a better way to implement a custom matchmaking?
You can send roomId in response in return of Zone RPC and then on ClientSide you can call JoinRoom API.
There are situations when i can't add the user to a room yet so he have to wait a while. I solved it by sending a chat message to the user when he is added to a room.
Yes, It depends on you how can you achieve it.
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
...