简体   繁体   English

Ajax请求与持久连接

[英]Ajax request vs Persist connection

We are developing a sport live score website. 我们正在开发体育实时比分网站。 From performance view which of these options are better? 从性能角度来看,以下哪个选项更好?

1- Clients send ajax request every 1-2 seconds to server for live plays and their scores. 1-客户端每1-2秒向服务器发送ajax请求以获取实时播放及其乐谱。

2- Using a persist connection library like WebSokcet or Laravel Broadcasting (or anything if better) and push any events to all clients? 2-使用持久连接库(例如WebSokcet或Laravel Broadcasting)(或更好的方法)将事件推送给所有客户端吗?

Push notification is much better but as my previous experience you should pay more attention to one critical point and make a decision first: 推送通知要好得多,但是根据我以前的经验,您应该更加注意一个关键点并首先做出决定:

  • for push notification you need for client acceptance and if he decline you will not be able to send them anything. 对于推送通知,您需要接受客户,如果他拒绝,您将无法向他们发送任何东西。 It means your application is affiliated to your clients choice and I think it's not the result that you expect. 这意味着您的应用程序隶属于您的客户选择,我认为这不是您期望的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM