Hi,
I am developing a game similar to Tic-Tac-To.
I used Facebook as my user base so I used "Storage Service" to store each Facebook users.
What I want is when a user is online he/she can see other login users(Facebook photo, name, scores,stats..) and then he/she can invite any other online user to play with.
MY QUESTION IS:
1. What is the best way to link the Appwarp Online Users with the Storage Service efficiently in order to retrieve their score/photo/name?
MY APPROACHES
a) Update the JSON of the Storage Service each time a user login or logout so that I can effeciently query for online users. But that will cause problem when user don't logout properly(Internet connection down, App crash...etc.).
b) Get list of Online users with warpClient.getOnlineUsers() and then use QueryBuilder to build compound query against the Storage Service. BUT HOW ABOUT PERFORMANCE ISSUE if I have 200,000 users and around 3000 online users???
ArrayList<String> usernames = warpClient.getOnlineUsers() ;
for(int i=0; i<usernames.size(); i++){
Query q = QueryBuilder.build("UserName",score.getUserName(), Operator.EQUALS);
queries.add(q);
}
// build a query for user profiles
Query finalQuery = queries.get(0);
for(int i=1; i<queries.size(); i++){
Query q = queries.get(i);
finalQuery = QueryBuilder.compoundOperator(q, Operator.OR, finalQuery);
}
Storage storageObj = storageService.findDocumentsByQuery(Constants.USER_DB_NAME, Constants.USER_PROFILE_COLLECTION, finalQuery);
ArrayList<Storage.JSONDocument> list = storageObj.getJsonDocList();
Your suggestion is much appreciated
Thanks;