Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2536712
  • 博文数量: 245
  • 博客积分: 4125
  • 博客等级: 上校
  • 技术积分: 3113
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-25 23:56
文章分类

全部博文(245)

文章存档

2015年(2)

2014年(26)

2013年(41)

2012年(40)

2011年(134)

2010年(2)

分类: 系统运维

2012-07-23 21:13:39

WebSocket是什么?

WebSocket规范,作为HTML5的一部分---包括WebSocket JavaScript接口,它定义了一个支持双向通信的单socket连接,通过它信息可以在客户端和服务端进行传输。WebSocket标准简化了复杂的双向web通信和连接管理。

WebSocket相对于CometAjax而言,代表了web通信的进一步发展方向。然而,每种技术都有它自己独特的优势(能力)。学习这些技术,根据它们的不同点,你就可以根据需求作出正确的选择。

 

创建你的测试例子

使用一个文本编辑器,复制下面的代码,保存为websocket.html(随便保存到哪里)。然后用浏览器打开它。这个页面将会自动连接,发送一条消息,输出响应,然后关闭连接。

 

WebSocket Test

WebSocket Test

 

 

 

WebSocket 例子

这里例举了一系列来自网络的WebSocket的例子


Echo测试

通过你的浏览器,依靠我们的WebSocket echo 服务器,测试一个WebSocket连接。

 

Kaazing.me

 这个链接已经迁移地址

 Several examples of WebSocket together on the one page. The bar along the bottom of the screen lets you connect to Google Chat over WebSocket.

Original link

 

Mr. Doob's 多用户画板

一个共享的画板,任何人都可以同时在这个画板上涂画。WebSocket被用于保持多个用户之间共享的位置数据。Websockets are used to keep up with the position data shared between users.

链接地址:

 

Rumpetroll

Norwegian for "tadpole", swim around with other rumpetrolls. WebSockets communicate positional data between all users.

链接地址:

 

WordSquared

A massively multiplayer online Scrabble-like word game.

链接地址:

 

WebGL Aquarium

This is a 100% HTML5, WebGL and JavaScript. Each of the 8 machines is running Chrome. They communicate using WebSockets to coordinate the differenct screens.

链接地址:

 

The WebSocket Difference

A video that visually demonstrates the performance improvements you get by using WebSocket.

 

Video Sync with WebSocket

Shows a single controller controlling the video that all connected users are watching.


本文链接:WebSocket 

阅读(3366) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

Aquester2012-07-26 11:16:33

HTML5的基础