HTML5技术

Bayeux协议 - 亮0000仔(11)

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

channel value "/meta/handshake" 值为/meta/handshake successful value false 值为false error a string with the description of the reason for the failure. 失败原因的描述字符串 An unsuccessful handshake

channel 
value "/meta/handshake" 
值为/meta/handshake
successful 
value false 
值为false
error
a string with the description of the reason for the failure.
失败原因的描述字符串

An unsuccessful handshake response MAY contain the message fields:

一个不成功的握手响应可以包含的消息字段:

 

supportedConnectionTypes 
The connection types supported by the server for the purposes of the connection being negotiated. This list MAY be a subset of the connection types actually supported if the server wishes to negotiate a specific connection type. 
服务端支持的连接类型,用作连接协商。如果服务端想协商为一种特定的连接类型,则连接支持列表可以是实际支持的子列表。
advice
version
minimumVersion
ext
id 
same value as request message id
和请求消息id相同

An example unsuccessful handshake response is:

一个不成功的握手响应例子为:

[
{
"channel": "/meta/handshake",
"version": "1.0",
"minimumVersion": "1.0beta",
"supportedConnectionTypes": ["long-polling","callback-polling"],
"successful": false,
"error": "Authentication failed",
"advice": { "reconnect": "none" }
}
]

For complex connection negotiations, multiple handshake messages may be exchanged between the Bayeux client and server. The handshake response will set the "successful" field to false until the handshake processs is complete. The advice and ext fields may be used to communicate additional information needed to complete the handshake process. An unsuccessful handshake response with reconnect advice of "handshake" is used to continue the connection negotiation. An unsuccessful handshake response with reconnect advice of "none" is used to terminate connection negotiations. 

对于复杂的连接协商,Bayeux客户端和服务端之间可能有多个握手消息交互。握手响应会设置successful字段为false,直到握手过程完成。advice和ext字段可以用来传送完成握手过程所需的额外信息。一个带有重连advice“handshake”的不成功的握手响应常用来继续连接协商。一个带有重连advice“none”的不成功的握手响应,常用来终止连接协商。

4.2. 连接 connect 4.2.1. 连接请求 connect Request

After a Bayeux client has discovered the server's capabilities with a handshake exchange, a connection is established by sending a message to the "/meta/connect" channel. This message may be transported over any of the transports indicated as supported by the server in the handshake response. 

经过握手交互一个Bayeux客户端发现了服务端的能力后,依靠发送给“/meta/connect”通道一个消息来建立一个连接。这个消息可以使用握手响应中服务端表明所支持的任何传输方式来传输。

A connect request MUST contain the message fields:

一个连接请求必须包含的消息字段:

 

channel
value "/meta/connect" 
值为“/meta/connect”
clientId 
The client ID returned in the handshake response 
握手响应中返回的客户端ID
connectionType 
The connection type used by the client for the purposes of this connection.
客户端连接所使用的连接类型。

A connect request MAY contain the message fields:

一个连接请求可能包含的消息字段:

ext
id

A client MAY send other messages in the same HTTP request with a connection message. A server MUST handle any other message sent in the same request as a connect message after the handling of the connect message is complete. 

一个客户端可以在和一个连接消息同样的HTTP请求中发送其他消息。服务端必须在连接消息处理完成后,处理和连接消息同样请求中发送的其他任何消息。

An example connect request is:

一个连接请求的例子为:

[
{
"channel": "/meta/connect",
"clientId": "Un1q31d3nt1f13r",
"connectionType": "long-polling"
}
]

A transport MUST maintain one and only one outstanding connect message. When a HTTP response that contains a /meta/connect response terminates, the client MUST wait at least the interval specified in the last received advice before following the advice to reestablish the connection 

一个传输通道必须维持一个且仅有一个未决连接信息。当一个HTTP响应包含了一个/meta/connect响应终止时,客户端必须至少等待上一个收到的advice指定的间隔后,才能继续建议连接。

4.2.2. 连接响应 connect Response

A Bayeux server MUST respond to a connect request with a connect response message over the same transport as used for the request. 

Bayeux服务端必须基于和请求相同的传输方式,用请求响应消息对连接请求做出响应。

A Bayeux server MAY wait to respond until there are event messages available in the subscribed channels for the client that need to be delivered to the client. 

Bayeux服务器可以一直等待,直到客户端订阅的通道上有事件消息需要发送到客户端时,再做出响应。

 

A connect responses MUST contain the message fields:

一个连接响应必须包含的消息字段:

 

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

网友点评