HTML5技术

Bayeux协议 - 亮0000仔(2)

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

A program that initiates communications. A HTTP client is a client that initiates TCP/IP connections for the purpose of sending HTTP requests. A Bayeux client initiates the Bayeux message exchange an

A program that initiates communications. A HTTP client is a client that initiates TCP/IP connections for the purpose of sending HTTP requests. A Bayeux client initiates the Bayeux message exchange and will typically execute within a HTTP client, but it is likely to have Bayeux clients that execute within HTTP servers. Implementations may distinguish between Bayeux clients running within a HTTP client and Bayeux clients running within the HTTP server. Specifically server-side Bayeux clients MAY be privileged clients with access to private information about other clients (e.g. client IDs) and subscriptions. 

 

客户端

初始化通信的程序。初始化TCP/IP连接以发送HTTP请求的HTTP客户端就是一个客户端。一个Bayeux客户端初始化Bayeux消息交换,并且通常会在HTTP客户端中执行,但是也可能在HTTP服务端中执行。运行于HTTP客户端的Bayeux客户端和运行于HTTP服务端中的Bayxue客户端,实现会有区别。具体来说,服务器端的Bayeux客户端可能更优先的访问其他客户端的私有信息(比如它们的client ID)和订阅。

 

服务端

An application program that accepts communications from clients. A HTTP server accepts TCP/IP connections in order to service HTTP requests by sending back HTTP responses. A Bayeux server accepts and responds to the message exchanges initiated by a Bayeux client.

 

服务端
接受来自客户端通信的应用程序。一个HTTP服务器接受TCP/IP连接,通过返回HTTP响应来服务HTTP请求。一个Bayeux服务端接受和响应由Bayeux客户端发起的消息交换。

request 
An HTTP request message as defined by section 5 of RFC 2616 
请求
RFC2616 第5章节所定义的HTTP请求消息

response
 A HTTP response message as defined by section 6 of RFC 2616 
响应
RFC2616 第6章节所定义的HTTP响应消息

message 
A message is a JSON object exchanged between client and server for the purposed of implementing the Bayeux protocol as defined by sections 3, 4 and 5. 
消息
一个消息是客户端和服务端交互的一个JSON对象,目的就是为了实现3、4、5章节中所定义的Bayeux协议。

event 
Application specific data that is sent over the Bayeux protocol 
事件
通过Bayeux协议所发送的应用相关的数据

envelope 
The transport specific message formate that wraps a standard Bayeux message. 
信封
用来封装标准Bayeux消息所传输的特定消息格式

1.4. 总体运作 1.4.1. HTTP

The HTTP protocol is a request/response protocol. A client sends a request to the server in the form of a request method, URI, and protocol version, followed by a MIME-like message containing request modifiers, client information, and optional body content over a connection with a server. The server responds with a status line, including the message's protocol version and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible entity-body content. 

HTTP是个请求/响应协议。客户端发送请求到服务端是基于一个到服务端的连接,所使用格式为请求方法,URI,协议版本,紧接着是包含请求描述符的一个类似MIME的消息,客户端信息,和可选的内容体。服务端用一个状态行来响应,包括消息的协议版本和一个成功或错误码,紧接着是包含服务端信息的类似MIME的消息,实体元信息,和可能的实体内容体。

 

The server may not initiate a connection with a client nor send an unrequested response to the client, thus asynchronous events cannot be delivered from server to client unless a previously issued request exists. In order to allow two way asynchronous communication, Bayeux supports the use of multiple HTTP connections between a client and server, so that previously issued requests are available to transport server to client messages. 

服务器不会初始化一个到客户端的连接,也不会发送一个未请求的响应到客户端,因此异步事件不能从服务端分发到客户端,除非一个之前相关的连接已存在。为允许两路异步通信,Bayeux支持一个客户端和服务端间多HTTP连接的使用,因此之前相关的请求可用来传输服务端至客户端的消息。

 

The recommendation of section 8.1.4 of RFC 2616 is that a single user client SHOULD NOT maintain more than 2 connection with any server, thus the Bayeux protocol MUST NOT require any more than two HTTP requests to be simultaneously handled by a server in order to handle all application (Bayeux based or otherwise) running within a client. 

 

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

网友点评
p