致力于php/ajax聊天系统
我一直在开发一种 ajax/php 聊天系统,用户可以在其中明显地互相聊天。我担心服务器负载,它最初的编程方式是每 x 秒自动刷新 div(聊天框),它只会这样做,因为用户处于活动状态,因为我超时了他们的不活动状态。如果它们保持不活动状态 10 分钟左右,它们将显示为空闲,然后系统将停止刷新。然后我研究了 HTML5 的服务器发送事件,它运行良好,但并非所有浏览器都可以使用它。
有谁有更好的解决方案或者div刷新现在可以吗?希望有人帮忙谢谢!
I have been working on an ajax/php chat system where users can obviously chat with one another. Im concerned about server load, the way it was originally programmed was auto refresh div (chat box) every x seconds it only did this is the user was active as i timed out their inactivity. If they remained inactive for 10 minutes or so they would be shown as idle the system would then stop refreshing. Then i looked into Server-Sent Events with HTML5 which worked well however not all browsers work with this.
Does anyone have a better solution or is the div refresh ok for now? Hope someone can help thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
考虑使用 COMET,或者看一下 Ajax Push Engine:链接
使用 COMET 的聊天系统的示例: 链接
Consider using COMET, or take a look at Ajax Push Engine: Link
An example of a chat system using COMET: Link