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 ---------------- |
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
-------------++------------+-------------+------------+------------
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 )
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 GlobbingA 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: