django - online game best-practice -


I am developing a Django-based MMO, and I wonder what is the best way for server-client communication Will happen . I found the solution:

  • Periodic AJAX call
  • To keep a connection alive and send data through it

After Edit in:

This will include "You have a message", "User attacked X", "Transport has arrived for your X" and so on The numbers can increase (such as 1 / sec), but for a specific user they should not go up to 1 minute

  • The server does not respond immediately
  • Request
  • Before time, there is a state update in the server, and the server eventually responds to the customer, which can then update.
  • If there is nothing new to tell in fact, the update period The client within, then the server responds with the "no news" message before it expires, and the client "rests" "The request starts the request.
  • Benefit:

    • The customer does not have to do Ajax
    • Probably too much silly voting traffic is not.

    Disadvantages:

    • The server needs to have a more active connection open, and serve them for at least once time periods. In addition,
    • Depending on how well the server code supports multi-threading (does PHP help out there?), This code for code to handle AJAX responses and Can be more difficult.

    Comments

    Popular posts from this blog

    c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

    Calling GetGUIThreadInfo from Outlook VBA -

    Obfuscating Python code? -