[
{
"channel": "/meta/subscribe",
"clientId": "Un1q31d3nt1f13r",
"subscription": "/foo/**"
}
]
A Bayeux server MUST respond to a subscribe request with a subscribe response message.
Bayeux服务端必须用订阅响应消息对订阅请求作出响应。
A Bayeux server MAY send event messages for the client in the same HTTP response as the subscribe response, including events for the channels just subscribed to.
Bayeux服务端可以在和订阅响应同样的HTTP响应中给客户端发送事件消息,包括所订阅通道的事件。
A subscribe responses MUST contain the message fields:
一个订阅响应必须包含的消息字段:
channel
value "/meta/subscribe"
值为"/meta/subscribe"
successful
boolean indicating the success or failure of the subscribe
表明订阅成功或失败的布尔值
clientId
The negotiated client ID
协商的客户端ID
subscription
a channel name or a channel pattern or an array of channel names and channel patterns.
一个通道名称或者一个通道模式或者一个通道名称和通道模式的数组
A subscribe response MAY contain the message fields:
一个订阅响应可能包含的消息字段:
error
advice
ext
id
same value as request message id
和请求消息id相同
timestamp
An example successful subscribe response is:
一个成功的订阅响应例子:
[
{
"channel": "/meta/subscribe",
"clientId": "Un1q31d3nt1f13r",
"subscription": "/foo/**",
"successful": true,
"error": ""
}
]
An example failed subscribe response is:
一个失败的订阅响应例子:
[
{
"channel": "/meta/subscribe",
"clientId": "Un1q31d3nt1f13r",
"subscription": "/bar/baz",
"successful": false,
"error": "403:/bar/baz:Permission Denied"
}
]
A connected Bayeux client may send unsubscribe messages to cancel interest in a channel and to stop published message delivery from the server to the unsubscribe channel.
一个已连接Bayeux客户端可以发送取消订阅消息,取消关心的一个通道,并停止从服务端投递到取消订阅通道的发布消息。
A unsubscribe request MUST contain the message fields:
一个取消订阅请求必须包含的消息字段:
channel
value "/meta/unsubscribe"
值为"/meta/unsubscribe"
clientId
The client ID returned in the handshake response
握手响应中返回的客户端ID
subscription
a channel name or a channel pattern or an array of channel names and channel patterns.
一个通道名称或者一个通道模式或者一个通道名称和通道模式的数组
A unsubscribe request MAY contain the message fields:
一个取消订阅请求可能包含的消息字段:
ext
id
An example unsubscribe request is:
一个取消订阅请求的例子:
[
{
"channel": "/meta/unsubscribe",
"clientId": "Un1q31d3nt1f13r",
"subscription": "/foo/**"
}
]
A Bayeux server MUST respond to a unsubscribe request with a unsubscribe response message.
Bayeux服务端必须用取消订阅响应消息对取消订阅请求做出响应。
A Bayeux server MAY send event messages for the client in the same HTTP response as the unsubscribe response, including events for the channels just unsubscribed to as long as the event was processed before the unsubscribe request.
Bayeux服务端可以在和取消订阅响应同样的HTTP响应中给客户端发送事件消息,包括取消订阅通道的事件,只要事件在取消请求前处理。
A unsubscribe responses MUST contain the message fields:
一个取消订阅响应必须包含的消息字段:
channel
value "/meta/unsubscribe"
值为"/meta/unsubscribe"
successful
boolean indicating the success or failure of the unsubscribe operation
表明取消订阅操作成功或失败的布尔值
clientId
The negotiated client ID
subscription
a channel name or a channel pattern or an array of channel names and channel patterns.
一个通道名称或者一个通道模式或者一个通道名称和通道模式的数组
A unsubscribe response MAY contain the message fields:
一个取消订阅响应可能包含的消息字段:
error
advice
ext
id
same value as request message id
和请求消息id相同
timestamp
An example unsubscribe response is:
一个取消订阅响应的例子:
[
{
"channel": "/meta/unsubscribe",
"clientId": "Un1q31d3nt1f13r",
"subscription": "/foo/**",
"successful": true,
"error": ""
}
]