By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,649 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,649 IT Pros & Developers. It's quick & easy.

How to send a response to one of the user between the two?

P: 2
Dear sir.
The project is related to the iphone application. and i am working at server side. The language used is PHP. About the application: It is a game that will be played at the server side. It is like teen patte. one user have three cards and he will play with another user that also have three different cards. the player that have the higher preference card will win the game.
Think myself as a server and you are the one player and the other player is Amit. now you see Amit is online and try to ping him. the request comes to me and i have to send a message to Amit that You wants to play with Him. How can i do this?

user1-------> Server------------------> user2

user1 click on user2 that is in online list. I will only get the id of both of the users. how can i make communication b/w both of the users.


Witing For reply.
Thank you in advance
Mar 2 '11 #1
Share this Question
Share on Google+
3 Replies


dlite922
Expert 100+
P: 1,584
Stateless Servers don't communicate with clients, rather the clients "ping" the server.

Your map should look like this:

John -----------> Server <------- Kim

1. John sends invite to Kim
2. Server stores the request in an invite table
3. Kim every x seconds asks the server if there is invites for me. Server comes back with a list, in this case Kim will see there's an open invite from John.

The rest of the game is played exactly the same way with both users updating the server's data.

Hope that helps,


Dan
Mar 2 '11 #2

HaLo2FrEeEk
100+
P: 404
The real fun comes in deciding how to balance your ping rate and server load. You could ping the server for new invites a few times a second. The erver would be under strain, but the end user will recieve updates more quickly. On the other hand, you could only ping the server once every 2 seconds. In this case the server won't stress as much, but the user will have to wait longer for updates. The key is finding a good balance.

Of, and you'll probably want to use AJAX.
Mar 4 '11 #3

P: 2
Thanks a lot sir. You help me a lot........................................
Mar 8 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.