What's the best way to coordinate javascript clients to a single backend game?

前端 未结 3 1674
忘掉有多难
忘掉有多难 2021-01-21 17:44

What\'s the best method to use to notify javascript client\'s of changes that occur in a game asynchronously (i.e. moves made by other clients). As an example, assume a turn bas

3条回答
  •  面向向阳花
    2021-01-21 17:54

    Polling can easily stack up and consume a lot of resources (eg: bandwidth), no matter how lightweight your requests and responses are.

    http://ajaxpatterns.org/Periodic_Refresh

    You might want to try and use Comet/HTTP Streaming http://ajaxpatterns.org/HTTP_Streaming

提交回复
热议问题