/foo/* Matches /foo/bar and /foo/boo. Does not match /foo, /foobar or /foo/bar/boo. /foo/** Matches /foo/bar, /foo/boo and /foo/bar/boo. Does not match /foo, /foobar or /foobar/boo
一组通道可以用通道通配符指定:
channel_pattern = *( "http://www.cnblogs.com/" channel_segment ) "http://www.cnblogs.com/" wild_card
wild_card = "*" | "**"
通道模式仅支持“*”支持单个段或“**”支持多个段的末尾通配符。示例为:
/foo/* Matches /foo/bar and /foo/boo. Does not match /foo, /foobar or /foo/bar/boo. /foo/** Matches /foo/bar, /foo/boo and /foo/bar/boo. Does not match /foo, /foobar or /foobar/boo
The channels within the "/meta/" segment are the channels used by the Bayeux protocol itself. Local server-side Bayeux clients MAY, and remote Bayeux clients SHOULD NOT, subscribe to meta channels. Messages published to meta channels MUST NOT be distributed to remote clients by Bayeux servers. A server side handler of a meta channel MAY publish response messages that are delivered only to the client that sent the original request message. If a message published to a meta channel contains an id field, then any response messages delivered to the client MUST contain an id field with the same value.
包含“/meta/”段的通道被Bayeux协议自身使用。本地服务器端Bayeux客户端可以,而远端Bayeux客户端不应该订阅meta通道。发布到meta通道的消息不可由Bayeux服务端分发到远端客户端。一个meta通道的服务端处理者可以发布消息,这些消息只能被发送到发送原始请求消息的客户端。如果发布到meta通道的消息包含id字段,发送到这个客户端的任何响应消息必须包含id字段,并且值相同。
2.2.3 Service通道Service ChannelThe channels within the "/service/" channel segement are special channels designed to assist request/response style messaging. Messages published to service channels are not distributed to any remote Bayeux clients. Handlers of service channels MAY deliver response messages to the client that published the request message. Servers SHOULD NOT record any subscriptions they receive for service channels. If a message published to a meta channel contains an id field, then any response messages SHOULD contain an id field with the same value or a value derived from the request id. Request response operations are described in detail in section 9.
包含“/service/”段的通道是特殊的通道,被设计用来协助请求/响应风格的消息传送。发布到service通道的消息不被分发到任何远端Bayeux客户端。service通道的处理者可以发送响应消息给发布请求消息的客户端。服务端不应该记录任何所接收到的对service通道的订阅。如果发布到meta通道的消息包含id字段,任何响应消息应该也包含id字段,并且值相同或者值为从请求id的派生值。请求响应操作在第9章节详细描述。
2.3. 版本VersionA protocol version is a integer followed by an optional "." separated sequence of alphanumeric elements:
version = integer *( "." version_element )
version_element = alphanum *( alphanum | "-" | "_" )
Versions are compared element by element, applying normal alphanumeric comparison to each element.
协议版本是一个整数,后面是一个可选的“.”分割的字母数字部分序列:
version = integer *( "." version_element )
version_element = alphanum *( alphanum | "-" | "_" )
版本可以逐部分来比较,每部分使用通常的字母数字比较方式。
A client ID is an random, non predictable sequence of alpha numeric characters:
clientId = alphanum *( alphanum )
Client IDs are generated by the server and SHOULD be created with a strong random algorithm that contains at least 128 truly random bits. Servers MUST ensure that client IDs are unique and SHOULD attempt to avoid reuse of client IDs. Client IDs are encoded for delivery as JSON strings.
客户端ID是一个随机数,不可预计的字母数字字符序列:
clientId = alphanum *( alphanum )
客户端ID由服务端生成,应该用强大的随机数算法创建,至少要包含128位精确的随机位。服务端必须确保客户端ID唯一并应该尽量重用客户端ID。客户端ID被编码成JSON字符串传送。
Bayeux messages are JSON encoded objects that contain an unordered sequence of name value pairs representing fields and values. Values may be a simple strings, numbers, boolean values, or complex JSON encoded objects. A Bayeux message MUST contain one and only one channel field which determines the type of the message and the allowable fields.
All Bayeux messages SHOULD be encapsulated in a JSON array so that multiple messages may be transported together. A Bayeux client or server MUST accept either array of messages and MAY accept a single message. The JSON message or array of messages is itself often encapsulated in transport specific formatting and encodings. Below is an example Bayeux message in a JSON array representing an event sent from a client to a server:
3. 消息字段定义Message Field Definitions 3.1. 通道channel