我正在尝试用iOS和Android客户端编写一个简单的聊天应用程序。我按照这里的教程http://blogs.msdn.com/b/youssefm/archive/2012/07/17/building-real-time-web-apps-with-asp-net-webapi-and-websockets.aspx来使用WebSockets。但是,我需要能够将消息发送到单个“聊天室”而不是向所有用户广播(实际上只有2个用户,我和我正在聊天的人)。目前我这样做:
<div class="container testimonials">
<h2>What People Are Saying</h2>
<div class="row">
<div class="col-md-1 col-xs-0">
</div>
<div class="col-md-5 col-xs-6">
<div class="quotes">
<blockquote>Extremely helpful! How to Interview is an easy read that hits all the major concerns about interviewing - and how to handle them appropriately. I recommend it to anyone who is trying to land a job.</blockquote>
</div>
</div>
<div class="col-md-5 col-xs-6">
<div class="quotes">
<blockquote>I interviewed at Google twice and didn't made the cut. I interviewed a third time -- trying the techniques in How to Interview -- and got the job. It changed the way I communicate and helped me get the job I wanted.</blockquote>
</div>
</div>
<div class="col-md-1 col-xs-0">
</div>
</div> <!-- /row -->
</div> <!-- /testimonials -->
使用linq来正确获取正确的房间还是有更好的方法来实现它?
答案 0 :(得分:1)
这是使用WebSockets的聊天服务器的示例:Chat application using Reactive Extennsions。
它使用另一个WebSocket框架,但这个想法应该基本相同。
答案 1 :(得分:0)
最好使用SignalR。网上有很多教程。