dongshou9343 2011-07-22 17:04
浏览 64
已采纳

即时挑战/通知系统

My setup: Currently running a dedicated server with an Apache, PHP, MYSQL. My DB is all set up and stores everything correctly. I'm just trying to figure out how to best display things live in an efficient way.

This would be a live challenging system for a web based game.

  • User A sends a challenge to User B

  • User B is alerted immediately and must take action on whether to Accept or Decline

  • Once User B accepts he and User A are both taken to a specific page that is served up by the DB (nothing special happens on this page,and they dont need to be in sync or anything)

The response from User B is a simple yes or no, no other parameters are set by User B, the page they are going to has already been defined when User A sends the challenge.

Whichever config I implement for this challenge system, I am assuming it will also work for instant sitewide notifications. The only difference is that notifications do not require an instant response from User B.

I have read up on long polling techniques, comet etc.. But im still looking for opinions on the best way to achieve this, and make it scalable.

I am open to trying anything as long as it will work with (or in tandem) to my current PHP and MYSQL set up. Thanks!

  • 写回答

1条回答 默认 最新

  • doubleyou1001 2011-07-23 02:18
    关注

    You're asking about Notifications from a Server to a Client. This can be implemented either by having the Client poll frequently for changes, or having the Server hold open access to the Client, and pushing changes. Both have their advantages and disadvantages.

    EDIT: More Information

    • Pull Method Advantages:
      • Easy to implement
      • Server can be pretty naïve about who's getting data
    • Pull Method Disadvantages:
      • Resource intensive on the client side, regardless of polling frequency
      • Time vs. Resource debacle: More frequent polls mean more resource utilization. Less resource utilization means less immediate data.
    • Push Method Advantages:
      • Server has more control overall
      • Data is immediately sent to the client
    • Push Method Disadvantages:
      • Potentially very resource intensive on the server side
      • You need to implement some way for the server to know how to reach each individual client (for example, Apple uses Device UUIDs for their APNS)

    What Wikipedia has to say (some really good stuff, actually): Pull, Push. If you are leaning toward a Push model, you might want to consider setting up your app as a Pushlet

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。