HTML5技术

Bayeux协议 - 亮0000仔(5)

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

BC ----------------------------------------- BS | ------------------ handshake request --- | | ---- handshake response ---------------- | | -------------------- connect request --- | ~ ~ wait | -----

BC ----------------------------------------- BS
| ------------------ handshake request ---> |
| <---- handshake response ---------------- |
| -------------------- connect request ---> |
~ ~ wait
| <------ connect response ---------------- |

Connection negotiation may be iterative and several handshake messages may be exchanged before a successful connection is obtained. Servers may also request connection renegotiation by sending an unsuccessful connect response with advice to reconnect with a handshake message. 

获得一个成功的连接前,连接协商可能反复交换多个握手消息。服务端也可能要求连接重新协商,这要发送一个不成功的连接响应,并在握手消息中建议重连。

BC ----------------------------------------- BS
| ------------------ handshake request ---> |
| <-- unsuccessful handshake response ----- |
| ------------------ handshake request ---> |
| <-- successful handshake response ------- |
| -------------------- connect request ---> |
~ ~ wait
| <------ connect response ---------------- |
| -------------------- connect request ---> |
| <---- unsucessful connect response ------ |
| ------------------ handshake request ---> |
| <-- successful handshake response ------- |
| -------------------- connect request ---> |
~ ~ wait
| <------ connect response ---------------- |

1.4.8. 未连接运作Unconnected operation

OPTIONALLY, messages can be sent without a prior handshake (see 5.1 Publish event messages). 

可选的,没有预先的握手,消息也能被发送。

| ------------------- message request ----> |
| <---- message response ------------------ |

This pattern is often useful when implementing non-browser clients for Bayeux servers. These clients often simply wish to address messages to other clients which the Bayeux server may be servicing, but do not wish to listen for events themselves. 

这种方式为Bayeux服务端实现非浏览器的客户端时通常会有用。这些客户端通常仅仅想发送消息到其他的有Bayeux服务端服务的客户端,而不想注意自身的事件。

1.5 状态表State Tables 1.5.1 客户端状态Client State

-------------++------------+-------------+----------- +------------
State/Event || handshake | Timeout | Successful | Disconnect
|| request | | connect | request
|| sent | | response | sent 
-------------++------------+-------------+----------- +------------
UNCONNECTED || CONNECTING | UNCONNECTED | |
CONNECTING || | UNCONNECTED | CONNECTED | UNCONNECTED
CONNECTED || | UNCONNECTED | | UNCONNECTED
-------------++------------+-------------+------------+------------

2. 协议涵义Protocol values 2.1. 基本组件Common Elements

The characters used for Bayeux names and identifiers are defined by the BNF definitions: 

用作Bayeux名称和标识符的字符用BNF定义:

alpha = lowalpha | upalpha

lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" |
"j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" |
"s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"

upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" |
"J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" |
"S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"

digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
"8" | "9"

alphanum = alpha | digit

mark = "-" | "_" | "!" | "~" | "(" | ")" | "$" | "@" 

string = *( alphanum | mark | " " | "http://www.cnblogs.com/" | "*" | "." )

token = ( alphanum | mark ) *( alphanum | mark )

integer = digit *( digit )

2.2. 通道Channel

Channels are identified by names that are styled as the absolute path component of a URI without parameters as defined by RFC2396. 

TODO?

 

channel_name = "http://www.cnblogs.com/" channel_segments
channel_segments = channel_segment *( "http://www.cnblogs.com/" channel_segment )
channel_segment = token 

The channel name consists of an initial "http://www.cnblogs.com/" followed by an optional sequence of path segments separated by a single slash "http://www.cnblogs.com/" character. Within a path segment, the character "http://www.cnblogs.com/" is reserved.

Channel names commencing with "/meta/" are reserved protocol use. Example non-meta channel names are: 

通道名称以“/”开头,剩下为“/”分割的可选的路径段序列。一个路径段内,字符“/”被保留。“/meta/”开头的通道名称保留为协议使用。非元通道名称示例如下:

/foo/foo/bar/foo-bar/(foobar)

2.2.1 通道通配符Channel Globbing

A set of channels may be specified with a channel globbing pattern:

channel_pattern = *( "http://www.cnblogs.com/" channel_segment ) "http://www.cnblogs.com/" wild_card
wild_card = "*" | "**"

The channel patterns support only trailing wildcards of either "*" to match a single segment or "**" to match multiple segments. Example channel patterns are:

 

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

网友点评
)