在 Backbone.js 中,为什么有时会“断开连接”?从服务器?
如果我在某些元素上单击得非常快,Backbone.js 将停止工作。也就是说...所有 AJAX 将停止工作。
当我更改路线并加载新内容时,没有加载任何内容,因为 AJAX 出现错误。我必须刷新页面并缓慢点击才能使其再次工作。
另外,只有当我快速单击有些繁重的操作时才会发生这种情况。
如何“重新连接”应用程序?
编辑:我认为如果我点击太快,我的服务器就会挂起。因为我点击太快后,我会等待,我的服务器控制台将在一段时间后开始打印请求。
编辑2:我什至不需要快速点击。单击几下(缓慢地)后,它就会挂起。
If I click really fast on some elements, Backbone.js will stop working. That is...all the AJAX will stop working.
When I change routes and load new things, nothing loads because AJAX bugs out. I have to refresh the page and click slowly to make it work again.
Also, this happens only when I'm clicking fast on actions that are somewhat heavy.
How can I "reconnect" the app?
Edit: I think my server hangs if I click too fast. Because after I click too fast, I wait, and my server's console will start printing the request after a while.
Edit 2: I don't even have to click fast. After a few clicks (slowly), it just hangs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是服务器端延迟问题:您的服务器无法同时接受多个请求,因为它已过载。因此,您应该调查服务器的性能。但是,您必须在客户端脚本中预见到此类问题。也就是说,您应该通知用户有关加载的信息,允许他停止加载,并不允许他同时发送太多请求。
This seems to be a server-side latency problem: your server cannot accept several requests at once because it is overloaded. So you should investigate about your server's performance. However, you have to anticipate this kind of problems in your client scripts. That is, you should inform the user about loadings, allow him to stop it, and disallow him to send too many simultaneous requests.
固定的。
我的服务器没有返回 ajax 调用的响应。
Fixed.
My server didn't return a response for the ajax call.