HTML5技术

Bayeux协议 - 亮0000仔(7)

字号+ 作者:H5之家 来源:H5之家 2015-12-07 17:06 我要评论( )

The channel message field MUST be included in every Bayeux message to specify the source or destination of the message. In a request, the channel specifies the destination of the message, and in a re

The channel message field MUST be included in every Bayeux message to specify the source or destination of the message. In a request, the channel specifies the destination of the message, and in a response it specifies the source of the message. 

通道消息字段必须包含在每个Bayeux消息中,以指定消息的源或目的。在一个请求中,通道指定了消息的目的地,而在一个响应中它制定了消息的源。

3.2. 版本version

The version message field MUST be included in messages to/from the "/meta/handshake" channel to indicate the protocol version expected by the client/server. 

版本消息字段必须包含在到或者来自“/meta/handshake”通道的消息中,表明客户端/服务端期望的协议版本。

3.3. 最小版本minimumVersion

The minimumVersion message field MAY be included in messages to/from the "/meta/handshake" channel to indicate the oldest protocol version that can be handled by the client/server. 

最小版本消息字段可以包含在到或者来自“/meta/handshake”通道的消息中,表明客户端/服务端所能处理的最低协议版本。

3.4. 支持连接类型supportedConnectionTypes

The supportedConnectionTypes field is included in messages to/from the "/meta/handshake" channel to allow clients and servers to reveal the transports that are supported. The value is an array of strings, with each string representing a transport name. Defined connection types include: 

支持连接类型字段包含在到或者来自“/meta/handshake”通道的消息中,允许客户端和服务端暴露支持的传输方式。值为字符串数组,每个字符串代表一种传输方式名称。定义的连接类型包括:

 

long-polling
messages are sent to the server as the 'message' parameter of a application/x-www-form-urlencoded encoded POST request. Messages are sent to the client as unencapsulated body content of a POST response. This transport is defined in section [XXX] of this memo. 
长轮询
消息通过application/x-www-form-urlencoded编码的POST请求的message参数发送到服务端。消息通过未封装的POST响应体发送客户端。这种传输方式定义在本备忘录的XXX章节中。

callback-polling 
messages are sent to the server as the 'message' parameter of a url encoded GET request. Responses are sent wrapped in a JavaScript callback in order to facilitate delivery. As specified by the JSON-P pseudo-protocol, the name of the callback to be triggered is passed to the server via the 'jsonp' GET parameter. In the absence of such a parameter, the name of the callback defaults to 'jsonpcallback'. 
回调轮询
消息通过通过url编码的GET请求的message参数发送到服务端。为容易发送,响应被封装到JavaScript回调函数中发送。按照JSON-P伪协议规范,被触发的回调函数名称作为jsonp GET参数传送到服务端。如果此参数不存在,回调函数名字默认为jsonpcallback。

iframe 
OPTIONAL transport using the document content of a hidden iframe element. 
iframe
可选的 用一个隐藏iframe元素的文档内容传输

flash 
OPTIONAL transport using the capabilities of a browser flash plugin.

flash

可选的 用浏览器的flash插件功能传输

 

All server and client implementations MUST support the "long-polling" connection type and SHOULD support "callback-polling". All other connection types are OPTIONAL. 

所有服务端和客户端实现必须支持“长轮询”连接类型,并且应该支持“回调轮询”。其他连接类型都是可选的。

 

 

3.5. clientId

The clientId message field uniquely identifies a client to a Bayeux server. The clientId message field MUST be included in every message sent to the server except for a messages sent to the "/meta/handshake" channel and a publish message (see 5.1 Publish event messages). The clientId field MUST be returned in every message response except for a failed handshake request and is OPTIONAL in a message delivery message. 

clientId消息字段唯一标识到一个Bayeux服务端的一个客户端。clientId消息字段必须包含在每个发往服务端的哦消息中,除了发往/meta/channel通道的消息和publish消息(参考 5.1 发布事件消息)。除了失败的握手请求响应,clientId字段必须在每个响应消息中中返回,clientId在消息到消息中是可选的。

3.6. 建议advice

The advice field provides a way for servers to inform clients of their preferred mode of client operation so that in conjunction with server-enforced limits, Bayeux implementations can prevent resource exhaustion and inelegant failure modes. 

advice字段为服务端提供了一种通知客户端他们首选的客户端操作模式,因此,结合强加的服务端限制,Bayeux实现能避免资源耗尽和不雅的失败情形。

 

The advice field is a JSON map containing general and transport specific values that indicate modes of operation, timeouts and other potential transport specific parameters. Fields may occur either in the top level of an advice or within a transport specific section. 

advice字段是一个JSON对象,包含了通用值和传输方式特定的值,有操作模式,超时,和其他潜在的特定传输方式参数。字段既可以在advice顶层也可以在传输方式特定段内。

 

Unless otherwise specified in sections 5 and 6, any Bayeux response message may contain an advice field. Advice received always superceeds any previous received advice.

An example advice field is

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • HTTP协议学习随笔 - 糖醋酸辣椒

    HTTP协议学习随笔 - 糖醋酸辣椒

    2017-05-01 18:03

  • 计算机网络——DNS协议的学习与实现 - 学数学的程序猿

    计算机网络——DNS协议的学习与实现 - 学数学的程序猿

    2017-04-16 10:00

  • 跨平台的.NET邮件协议MailKit组件解析 - 彭泽0902

    跨平台的.NET邮件协议MailKit组件解析 - 彭泽0902

    2017-03-17 13:01

  • TCP/IP协议族(一) HTTP简介、请求方法与响应状态码 - 青玉伏案

    TCP/IP协议族(一) HTTP简介、请求方法与响应状态码 - 青玉伏案

    2017-02-03 11:02

网友点评
m