HTML5技术

Bayeux协议 - 亮0000仔(16)

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

It is RECOMMENDED that Bayeux server implementations use the cookie "Bayeux_HTTP_ID" to identify a HTTP client and to thus detect multiple Bayeux clients running within the same HTTP client. Once det

It is RECOMMENDED that Bayeux server implementations use the cookie "Bayeux_HTTP_ID" to identify a HTTP client and to thus detect multiple Bayeux clients running within the same HTTP client. Once detected, the server SHOULD not wait for messages in connect and SHOULD use the advice interval mechanism to establish traditional polling. 

推荐Bayeux服务端实现用cookie"Bayeux_HTTP_ID"来标识一个HTTP客户端,以此来侦测同一个HTTP客户端内的多个Bayeux客户端。一旦侦测到,服务端不应该等待连接的消息,应该使用建议间隔机制来建立传统的轮询。

8.2 客户端多框架处理 Client Multi frame handling

It is RECOMMENDED that Bayeux client implementations use client side persistence or cookies to detect multiple intances of Bayeux clients running within the same HTTP client. Once detected, the user MAY be offered the option to disconnect all but one of the clients. It MAY be possible for client implementations to use client side persistence to share a Bayeux client instance.

推荐Bayeux客户端实现使用客户侧的存储或cookie来侦测同一个HTTP客户端内的多Bayeux客户端实例。一旦发现,用户可以选择断开所有客户端而只保留一个。客户端实现也可能用客户端侧的持久化来共享一个Bayeux客户端实例。

 

9. service通道的请求/响应操作 Request / Response operation with service channels

The publish/subscribe paradigm that is directly supported by the Bayeux protocol is difficult to use to efficiently implement the request/response paradigm between a client and a server. The /service/** channel space has been designated as a special channel space to allow efficient transport of application request and responses over Bayeux channels. Messages published to service channels are not distributed to other Bayeux clients so these channels can be used for private requests between a Bayeux client and a server side handlers.

A trivial example would be an echo service, that sent any message received from a client back to that client unaltered. Bayeux clients would subscribe the the /service/echo channel, but the Bayeux server would not need to record this subscription. When a client publishes a message to the /service/echo channel, it will be delivered only to server-side subscribers (in an implementation depedent fashion). The server side handler for the echo service would handle each message received by publishing a response directly to the client regardless of any subscription. As the client has subscribed to /service/echo, the response message will be routed correctly within the client to the appropriate application handler.

发布订阅模式被Bayeux协议直接支持,但在客户端和服务端之间有效的实现请求响应模式就比较困难。/service/**通道空间被指定为一个特殊的通道空间,以允许基于Bayeux通道的应用请求响应的有效传输。发布到service通道的消息不被分发到其他Bayeux客户端,因此,这些通道可用作Bayeux客户端和服务端处理间的私有请求。
举一个回显服务例子,发送的任何消息原封不动的返回到那个客户端。Bayeux客户端可以订阅/service/echo通道,但是Bayeux服务端不必记录这个订阅。当客户端发布一个到/service/echo通道的消息时,仅仅会被投送到服务端的订阅者(使用实现相关的方式)。echo服务的服务端处理会直接发布接收消息的响应到客户端,而不关心任何订阅。因为客户端已经订阅到/service/echo,响应消息会被无误的路由,在客户端中应用适当的处理。

 

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

网友点评
"