开发聊天模块 [英] Developing chat Module
本文介绍了开发聊天模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发的asp.net在线聊天应用程序。我面临着像假设的问题有两个用户开始通信。当第一个用户编写基于JavaScript的聊天框的消息然后AJAX请求发送到服务器。但我怎么开第二个用户的聊天框,以便他性反应的第一个用户信息?
I am developing online Chat application in asp.net. I am facing a problem like suppose there are two users starts communication. When first user write a message in javascript based chat box Then ajax request goes to server. BUt how I open second user chat box so he responce the first user message?
推荐答案
您应该研究长轮询和网络插口。这允许您的客户端有更新推送到他们更有效。你可以轮询服务器每x秒,但它会浪费资源。
You should research long polling and web sockets. These allow your clients to have updates pushed to them more effectively. You could poll the server every x seconds, but it would be wasteful of resources.
这篇关于开发聊天模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文