This document specifies a protocol for the Internet community, and requests discussion and suggestions for improvement. This memo is written in the style and spirit of an IETF RFC but is not, as of yet, an official IETF RFC. Distribution of this memo is unlimited. This memo is written in UK English.
这份文档为互联网社区详细描述了一个协议,请求讨论并提出改进建议。此备忘录以 IETF RFC 风格写作,但是它不是、也还没有成为官方IETF RFC。此备忘录使用英式英文,对分发无限制。
版权声明
版权所有Dojo基金会 (2007). 保留所有权利
摘要
Bayeux is a protocol for transporting asynchronous messages (primarily over HTTP), with low latency between a web server.
Bayeux是在和web服务器间提供低时延、传输异步消息的协议(主要基于HTTP)。
目录
1. 介绍 1.1. 目的 1.2. 需求 1.3. 术语 1.4. 总体运作 1.4.1. HTTP 1.4.2. 非 HTTP 传输 1.4.3. Javascript 1.4.4. 客户端至服务端事件分发 1.4.5. 服务端至客户端事件分发 1.4.5.i 轮询传输 1.4.5.ii 流传输 1.4.6. 双连接运作 1.4.7. 连接协商 1.4.8. 不连接运作 1.5 状态表 1.5.1 客户端状态 2. 协议涵义 2.1. 基本组件 2.2.通道 2.2.1 通道通配符 2.2.2 Meta通道 2.2.3 Service通道 2.3. 版本 2.4. 客户端ID 2.5 消息 3. 消息字段定义 3.1. channel 3.2. version 3.3. minimumVersion 3.4. supportedConnectionTypes 3.5. clientId 3.6. advice 3.6.1. reconnect advice 3.6.2. interval advice 3.6.3. multiple-clients advice 3.6.4. hosts advice 3.7. connectionType 3.8. id 3.9. timestamp 3.10. data 3.11. connectionId 3.12. successful 3.13. subscription 3.14. error 3.15. ext 3.16. json-comment-filtered 4. Meta 消息定义 4.1. 握手 4.1.1. 握手请求 4.1.2. 握手响应 4.2. 连接 4.2.1. 连接请求 4.2.2. 连接响应 4.4. 断开 4.4.1. 断开请求 4.4.2. 断开响应 4.5. 订阅 4.5.1. 订阅请求 4.5.2. 订阅响应 4.6. 取消订阅 4.6.1. 取消订阅请求 4.6.2. 取消订阅响应 5. 事件消息定义 5.1. 发布事件消息 5.1.1. 发布请求 5.1.2. 发布响应 5.2. 分发事件消息 6. 传输 6.1. long-polling 6.1.1 long-polling 请求消息 6.1.2 long-polling 响应消息 6.2. callback-polling 6.2.1 callback-polling 请求消息 6.2.2 callback-polling 响应消息 7. 安全 7.1.鉴权 7.2. Ajax 劫持 8. 多frame 运作 8.1 服务端多frame侦测 8.2 客户端多frame侦测 9. service 通道的请求响应运作
1. 介绍 1.1. 目的
The primary purpose of Bayeux is to support responsive 2 way interactions between web clients using Ajax and the web server.
Bayexu协议的主要目的,是在使用Ajax的web客户端和web服务器之间,提供2种交互应答方式。
Bayeux is a protocol for transporting asynchronous messages (primarily over HTTP), with low latency between a web server and a web browser. The messages are routed via named channels and can be delivered: server to client, client to server and client to client (via the server). By default, publish subscribe routing semantics are applied to the channels, but other routing models are also supported.
Bayeux是在web服务器和web浏览器间提供低时延、传输异步消息的协议(主要基于HTTP)。消息通过命名通道被路由,并被分发:服务端至客户端,客户端至服务端和客户端至客户端(通过服务器中转)。默认时,发布订阅路由语义应用于通道,但是其他路由模型也被支持。
Delivery of asynchronous messages from the server to a web client is often described as "server-push". The combination of server push techniques with an Ajax web application has been called "comet". Cometd is a project by the Dojo Foundation to provide multiple implementation of the Bayeux project in several programming languages.
服务器至web客户端的异步消息分发常被称之为“server-push”。web应用中混合Ajax和server push的技术被称为“comet”。 Cometd是Dojo基金会的一个项目,它提供Bayeux项目在不同编程语言中的多个实现。
Bayeux seeks to reduce the complexity of developing Comet-driven applications by allowing implementers to more easily interoperate, solve common message distribution and routing problems, and provide mechanisms for incremental improvement and extension.
Bayeux致力于减少开发 Comet驱动应用的复杂性,允许实现者更容易的交互,解决通用消息分发和路由问题,同时也提供可持续改进和扩展的机制。
1.2. 需求
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC2119. An implementation is not compliant if it fails to satisfy one or more of the MUST or REQUIRED level requirements for the protocols it implements. An implementation that satisfies all the MUST or REQUIRED level and all the SHOULD level requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the MUST level requirements but not all the SHOULD level requirements for its protocols is said to be "conditionally compliant."
这份文档中,关键词“必须”、“禁止”、“需要的”、“必须”、“必须不”、“应该”、“不应该”、“推荐的”、“可能”、“可选的”要按照 RFC2119中所描述的来理解。如果一个本协议的实现,没有满足一个或多个“必须”或“需要的”级别的需求,那它就是不兼容的。如果一个本协议的实现,满足了所有“必须”或“需要的”级别的需求和所有“应该”级别的需求,那它就是“完全兼容”;一个满足“必须”级别的需求但并非满足所有“应该”级别的需求的协议实现,就是“部分兼容”。
1.3. 术语
This specification uses a number of terms to refer to the roles played by participants in, and objects of, Bayeux communication:
本规范使用一系列术语来引用Bayeux通信中所参与的角色以及对象。
client