注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

神魔破杜梓的叨叨堂

Programming every day!

 
 
 

日志

 
 
 
 

基于asp.net的即时通讯  

2008-05-06 20:28:45|  分类: My Tech |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

原文:Web-Based Instant Messenger with ASP.NET, Remote Scripting and WSMQ

A few weeks ago, an article appeared on O'Rielly that showed an example chat application that utilized Amazon's Simple Queue service to store chat messages.  IMO, using a middle-ware Queuing system over a Web Service is a great idea (which was the motivation for me creating www.wsmq.com), and the idea of creating a chat application to demonstrate the features of a Web Service Queue is a good one. So, I borrowed the idea, and set about to create an instant messenger using WSMQ  as the back-end chat storage mechanism.

I wanted to create a 100% Web-based chat, with out resorting to Java or other bits that don't play well in a web browser. The first problem I was faced with was how to make a request to the WSMQ server without refreshing the browser window.  I found a good remote scripting JavaScript library from Alvaro Mendez that allows you to call any method on an ASP.NET page from within client-side JavaScript.  This was the biggest hurdle for creating a usable chat application.  The rest was fairly straight forward.  It involved some relatively simple JavaScript, and some ASP.NET code to connect to WSMQ to queue and receive chat messages.  The architecture ended up looking like this.

How does it work?

  1. A controller page polls for new chat conversations, using a remote scripting (RS) call to the back-end ASPX page control. 
  2. This ASPX control connects to the WSMQ Service and peeks the users queue to check to see if there are any new conversations on the user's chat queue. 
  3. If it finds a new conversation, it returns the user name requesting the new chat to the controller via an RS callback.
  4. The controller launches a new chat window and identifies the chat conversation partner.
  5. Each chat window polls the back-end ASPX page, which connects to WSMQ,  receives the message and returns it to the calling window via a RS callback. 
  6. When the user clicks “Send“ or presses enter in the chat window, a RS call is made to send each message to chat partner's queue. 

Try it out online here, if there's no one else chatting, you can chat with yourself by clicking on your name.  You can download the full project from the WSMQ beta program page.  We're offering free accounts to use WSMQ Hosted version with our Beta program, so sign up if you haven't already. You'll be able to run the web application locally using the WSMQ Hosted queue as the chat message store

-Brendan

  评论这张
 
阅读(352)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017