JoinRoom connection error and bad request

0 votes

I have two users A and B.  User A created the room and invited user B to play with him. User A sends the push notification to user B's device with Room ID in it. When user B got the notification. user B will be connected to server first then user B will be joined to room ID given in notification dictionary by pressing play button. Sometimes i got an error in "-(void)onJoinRoomDone:(RoomEvent*)roomEvent" with result 4 and 5 (BAD_REQUEST and CONNECTION_ERR). It does not happen every time. It happens sometimes. I just want to make sure is this problem happening to other developers also ? Becuase it was working till yesterday.  

asked Mar 22, 2014 in AppWarp by nilesh (109 points)
edited Mar 24, 2014 by nilesh

1 Answer

+1 vote
How does user B know the room id to join? Does A send a push notification with room id in it?

Connection_err comes if the client is not successfully connected to the server when the joinRoom API is being called.

Bad Request is if you pass in null/empty room id or if the room is already full (eg: it has 2 players in it and its maxUsers is 2)
answered Mar 22, 2014 by dhruvc (1,099 points)
Yes dhruv, A sends push notification to B including room id in it. It was working fine before.
1) The push is being successfully received.
 
2) You are getting a valid roomId.

3) Then you connect to AppWarp.

4) After you've successfully connected - you call joinRoom with the roomId you got before.

5) Now you get onJoinRoomDone with connection error?
Yes exactly. Sometimes connection error sometimes bad request. Let me tell you what i did in my code. I have several screens. consider this after server connected.

Play card listing screen (List of play card icons he has to choose to play, I store the selected play cards of different users with his name in room properties. so that a player can select unique cards ) in which i register room listner in viewwillappear and deregister room listner in viewwilldisappear. Becuase after selecting cards i don't want to get events of room in this class. So the new Game Play screen will be pushed and Now GamePlay screen will register for room listner and get the room events.

Does this create any problem ?
I am also getting same issue.
There shouldn't be a problem with adding/removing request listeners.
Also the fact that you are getting callbacks means that there is no problem with the listeners.

As I have mentioned earlier - connection_error indicates that the client is not successfully connected to the server.

Can you call getConnectionState and confirm that the connection state is connected or not.

For example

    WarpClient *_warpClient = [WarpClient getInstance];
    if ([_warpClient getConnectionState] == CONNECTED) {
        if (roomID && [roomID length]) {
            [[WarpClient getInstance] joinRoom:roomId];
        }
    }

Also put a break point and take a look at the call stack when you are getting the onJoinRoomDone callback.
The calling function will be either joinRoom (case of synchronous failure) or handleJoinRoomResponse (case of failure from server).
This will help in further narrowing down the issue.
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
...