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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaushik ankur
    New Member
    • Mar 2011
    • 2

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

    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
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    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

    Comment

    • HaLo2FrEeEk
      Contributor
      • Feb 2007
      • 404

      #3
      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.

      Comment

      • kaushik ankur
        New Member
        • Mar 2011
        • 2

        #4
        Thanks a lot sir. You help me a lot............ ............... .............

        Comment

        Working...