[英]How can I create a chat communication channel between 2 users in asp.net
I want to add a chat application in my website. 我想在我的网站上添加聊天应用程序。 I have developed almost part of chat application.But I am getting problem to create chat communication channel.I an using Web-Service to insert and retrieve messages from data base.
我已经开发了聊天应用程序的几乎一部分。但是在创建聊天通信通道时遇到了问题。我使用Web服务从数据库中插入和检索消息。 When I enter the new message then another user can not read that message until he will reload its chat window.
当我输入新消息时,其他用户将无法读取该消息,直到他重新加载其聊天窗口。
I'm not totally sure what your question is - however: 我不确定您的问题是什么-但是:
If you want to create a chat app in .Net why not look into SignalR? 如果要在.Net中创建聊天应用程序,为什么不考虑SignalR?
https://github.com/SignalR/SignalR/ https://github.com/SignalR/SignalR/
They have a demo that shows (In a short amount of code) how to write a chat application. 他们有一个演示,以简短的代码演示了如何编写聊天应用程序。
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx
There is a live chat app written using SignalR also - http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx 还有一个使用SignalR编写的实时聊天应用-http: //www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx
If you are really up to creating you own chat app. 如果您真的有能力创建自己的聊天应用程序。 Then here is some idea on how you can make it work based on your current progress.
接下来是一些有关如何根据当前进度使其工作的想法。
You have to use an Ajax Timer to constantly get update on new messages. 您必须使用Ajax计时器来不断获取新消息的更新。
Are you in someway imitating facebook chat? 您是否正在模仿Facebook聊天?
first try the chat using web pages for easier implementation then work your way up on making it a widget. 首先尝试使用网页进行聊天以简化实现,然后逐步将其制作为小部件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.