基于Web的IM简介

 

Web based Instant Messenger

基于Web的IM简介

Web IM的特性:无需安装客户端,穿透防火墙,与社区的紧密结合

Web IM的应用:社区用户的交流,在线客服,CRM

Web IM实现技术

Web IM的实现技术主要有:

基于插件的技术:如ActiveX,插件相对稳定,但插件需要用户自己允许并下载安装,而大多数用户担心安装了黑客软件或插件对计算机系统不好而不愿意安装,并且上网助手等软件也拦截插件,导致很多用户无法使用。另外,ActiveX受平台限制,只能在IE下使用。

 

基于Flash的技术:典型的如Yahoo web messenger,结合FlashAjaxGoogle Talk Gadget

 

纯粹的基于HTTP的技术

 

前端使用AjaxWeb IMmeebo, ebuddy, ILoveIm, MSN Web Messenger, KoolIM等。

后台使用cometWeb IMmeebo, gtalk等。

支持wap的有ebuddy, Yahoo Web Messenger, MSN Web Messenger, Google Talk, Mabber, AIM Express Web Messengers Handbook

 

Web IM

1. 国内有独立IMWeb版:Web Popo, WebQQ, 也有与论坛等结合的IMsohu小纸条,新浪“纸条箱”,QQ空间“小纸条”,淘宝旺旺等,

2. 国外:基于上都是独立IMWeb版。或者集成多种IMWeb版,如meebo, flcikim, ebuddy等。

相关技术

Comet (Server-Push)

Comet技术的一个重要组成部分就是event-drived web server,目前商用的实现已经出现,如lightstreamerLightstreamer Dojo Demohttp://app.lightstreamer.com/DojoDemo/

  

几个开源的支持CometLibrary

  • Orbited :一种开源的分布式Comet服务器
  • AjaxMessaging Ruby on RailsComet插件
  • Pushlets :一个开源框架,可以让服务器端java对象推送事件到浏览器端javascriptjava applet,或者flash应用程序
  • Lightstreamer :提供基于AJAX-COMET模式的HTTP流的商业实现
  • Pjax Ajax的推送技术
Scalability(可伸缩性,可扩展性)

Because Comet applications send events in real time, they typically use more resources than other types of web applications, making them more difficult to scale (grow to support large numbers of users).

  • Comet relies on continually keeping at least one server–client connection open for each client. Traditional web servers, designed for the page-by-page application architecture, cannot cope with such large numbers of open connections. This is a vertical scalability problem: it is difficult to handle many users on each server.
  • Additionally, because Comet applications are often interactive, allowing arbitrary groups of users to communicate with each-other, splitting tasks among servers is more difficult than for applications in which each user acts independently. This is a horizontal scalability problem: it is difficult to add more servers to the application.

Comet在可伸缩性上的提升:

http://cometdaily.com/2008/01/07/20000-reasons-that-comet-scales/

性能After some recent optimizations, the Dojo Cometd implementation of the Bayeux protocol running on the Jetty web server can now handle up to 20,000 simultaneous users per server while maintaining sub-second latency.

测试环境mid-sized Amazon EC2 virtual servers: 7.5 GB of memory, 2×2 EC2 Compute Units, 64-bit platform running Ubuntu 7.10 and Sun JVM 1.5.0_13. A single virtual machine was used as the Cometd server and between 1 and 3 virtual machines were used to generate the load of 20,000 clients.

DWR

DWR(Direct Web Remoting)是一个WEB远程调用框架.利用这个框架可以让AJAX开发变得很简单.利用DWR可以在客户端利用JavaScript直接调用服务端的Java方法并返回值给JavaScript就好像直接本地客户端调用一样(DWR根据Java类来动态生成JavaScrip代码)

 

可以使用DWR实现Comet Web应用程序,当前支持Comet的容器有Grizzly Tomcat Jetty等,其中,Jetty是做Ajax+Java开发的首选服务器端开发平台。

 

面向 Java 开发人员的 Ajax: 使用 Jetty Direct Web Remoting 编写可扩展的 Comet 应用程序http://www.ibm.com/developerworks/cn/java/j-jettydwr/index.html

 

Ajax推送与拉取方式的比较http://www.infoq.com/cn/news/2007/07/pushvspull

实现基于web的实时事件通知的方法:

Dojo

DojoComet库,dojo.io.bind()

DWR has joined the Dojo Foundation, AJAX Frameworks: Mixing Dojo & DWR

几个典型的Web IM 分析

国内与论坛结合的众多Web IM中,sohu的小纸条是比较有特色和代表性的。

Sohu 小纸条

搜狐小纸条是基于Web的即时通讯工具。基于搜狐统一登录系统(Passport),它被搜狐几乎所有重要产品(包括搜狐博客、搜狐社区、ChinaRen等)运用到各自的好友系统中去。成为多数搜狐用户交流沟通的重要工具。借助用户的既存关系,搜狐小纸条的沟通交流显得更加安全,粘性更高。搜狐小纸条将作为搜狐主线产品的联络工具,它不再只是交流沟通的工具,还将成为一个资源共享、信息传递、关系传递等多元化,全方位的产品。

 

sohu论坛在线人数:69264(中午11:49),88688(下午3点),

 

http://luxuelin.blog.sohu.com/63653813.html

http://xiaonei.chinaren.com/blog/zoud

http://messenger.blog.sohu.com/

http://sohume.q.sohu.com/topics

 

ChinaRen/SOHU 小纸条系统核心 核心为3个小server系统:online2(在线系统业务逻辑)userv(用户资料系统)cserv(LRU缓存) 这三个子系统都是UDP+线程池结构,单进程+多线程。配备java接口,apache_modjsonxml接口。 online2包括了大部分业务逻辑,包括,上线,好友系统,纸条系统。 userv包括设置用户各种属性,信息。 cserv是个大的lru缓存,用于减小磁盘IO。可以放各种信息块,包括用户信息,好友,留言等。目前配备4台服务器(DL380xeon:3G*2SCSI:146G raidRam:2G),用户分布到4台服务器上,相互交互。服务器可以由1台到2台,到4台,到8台。底层存储为文件存储(无数据库),用reiserfs 配套系统: mod_online,两个版本,apachelighttpd版本,用于页面上显示蜡烛人。请求量巨大,目前用lighttpd版本的 mod_online。放在sohusquid前端机器上,运行在8080,大概8台,每台请求量大概500-800个每秒。蜡烛人在所有ChinaRen页面有ID的地方显示用户是否在线。 目前这套在线系统,作为SOHUIM的内核原型。准备开发WEBIM系统,用户所有SOHU矩阵用户的联络。

(引自:http://luxuelin.blog.sohu.com/63653813.html

 

Sohu 小纸条目前共有8台服务器(2006年的数据)

 

问题:由于没有采用Ajax,聊天延迟非常大,网上有反映:“非常的费资源,聊着聊着,网页越来越慢,而且输入法也会因为资源的占用而发生一些不好的表现”;对Firefox技术不好;

 

http://images.sohu.com/cs/sohuim/xiaozt/version/2.0/js/webim.1.3.7.js

 对比新浪的“纸条箱”

与搜狐小纸条相比,新浪的“纸条箱”还不是IM,只是有好友,发纸条功能,但是不能即时聊天,没有IM窗口,不能看用户的状态,而且一个非常不好的功能就是:每次发纸条都要输入验证码。

新浪“纸条箱”的附加功能:对好友进行了自动分类,如博客好友,论坛好友等。

Meebo

http://blog.meebo.com/?p=129

支持特性:文件传输,Meebo Rooms

前端Ajax,后端Comethttp serverlightTPD

MeeboLoad Balancinghttp://blog.meebo.com/?p=127

服务器端用fastCGI实现(C/C++),

http://blog.meebo.com/?p=23

 

Meebo的三层:client-side (JavaScript), the communication layer, and then Gaim

Ajax的使用:Use modified versions of the prototype.js $ function and dojo.require,通过使用Ajaxmeebo可以做到无刷新的显示新的内容。使用Ajax有两种方式,一是每隔3~4秒轮询,发信息给服务器询问是否有更新,但是这个延迟也很大,Meebo使用Comet (long-polling)技术,

Meebo的通信方式:为了有更快响应,Simulate event-driven communication between the client and the communication layer. The client pings our servers occasionally to tell the server that the IM session (browser window) is still open. If there are any messages that the client or server needs to communicate, those messages are sent immediately. When there are no events, the communication layer sleeps until it sees a new event that needs to be handled. By doing so, we don’t hammer the servers and minimize the amount of network traffic.

 

当用户启动一个IM Sessionmeebo就创建一个与AOL, Jabber, MSN, and Yahoo’s等新的连接(通过开源的GAIM库),moobo的作者(Sandy)对GAIM进行了优化,这样,在每台服务器上可以运行很多GAIM实例,

 

文件传输:使用Amazon S3/EC2中转,http://blog.meebo.com/?p=355

 

meebo meallows users to embed a version of Meebo on their personal website

 

On October 29, 2007, Meebo announced the abilitly to use applications of Video Conferencing(from MeBeam), Voice Chat(from Pudding Media), Video/Audio Call(from TokBox), Group Voice Call(from TalkShoe), Live Broadcast(from Ustream.tv), and you can create your own applications to play games or anything you'd like.

Google Talk on the web (Google Talk Gadget)

Google Talk GadgetFlash实现,可以把Google Talk嵌入到各种网页里去。

开源的Web IM

IM 客户端软件最重要的有PidginMiranda,它们实现了流行IM软件的各种协议。

JWChat:一个基于webJabber客户端。

IM协议

http://www.answers.com/topic/comparison-of-instant-messaging-protocols

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值