Hello everyone,
I'm just new to Appwarp and i'm trying to develop a sample app.
The idea in simple is: 1 user connect to server, create a turn base room, and join that room.
theClient.createTurnRoom("dmm", "khang", 2, null, 1000000);
and
public void onCreateRoomDone(RoomEvent re) {
if (re.getResult() == 0) {
System.out.println("Created 1 room id" + re.getData().getId());
theClient.joinRoom(re.getData().getId());
}
System.out.println("The result of creating:" + re.getResult());
}
1 more user connect to server. Get all rooms and join the first room.
theClient.getAllRooms();
and:
public void onGetAllRoomsDone(AllRoomsEvent are) {
System.out.println("Get all rooms result: " + are.getResult());
if (are.getResult() == 0 && are.getRoomIds() == null) {
theClient.createTurnRoom("Khang", "ABCDEF", 2, null, 1000000);
} else if (are.getRoomIds() != null) {
for (int i = 0; i < are.getRoomIds().length; i++) {
System.out.println(are.getRoomIds()[i]);
}
theClient.joinRoom(are.getRoomIds()[0]);
System.out.println("Have room, joining");
}
}
I got stuck at there, where the first user create and join room successfully but the second user, who get all room and join the first room got result = 4 in onJoinRoomDone
public void onJoinRoomDone(RoomEvent re) {
if (re.getResult() == 0) {
theClient.subscribeRoom(re.getData().getId());
System.out.println("Joined room" + re.getData().getId());
} else {
System.out.println(re.getResult);
}
}