我有一个连接到HTTP Server-HTTP 1.1的HTTP客户端,并且TCP连接保持不变. HTTP客户端在一定时间间隔内发送请求,并接收来自服务器的响应.
I have a HTTP Client connected to a HTTP Server - HTTP 1.1 and the TCP connection is persisted. HTTP client is sending request over an interval and receives response from server.
在此持久的TCP连接中,HTTP Server可以通过现有的TCP连接向HTTP客户端发送HTTP请求吗?(我们需要这样做-表示页面中的信息正在动态变化(示例:有人击中一个目标/有人击中6/有人击中一个检票口/有人杀死了VVVIP等)
In this persisted TCP connection, can HTTP Server send a HTTP request over the existing TCP connection to the HTTP client? (We need this - say the page has an information which is changing dynamically (Example: some one hit a goal / some one hit six / some one took a wicket / some VVVIP killed / etc).
现有标准是否允许HTTP服务器向其连接的客户端发送HTTP请求?
Does the existing standard allows HTTP server to send HTTP request to its connected client?
注意:我不是在查看页面刷新/其他Web或应用程序协议,例如AJAX ...
Note: I am not looking at page refresh / other web or application protocols like AJAX...
推荐答案您正在请求服务器推送,否,HTTP/1.1不支持它.
You are asking for a server push, and no, it is not supported by HTTP/1.1.
请求标头与响应标头不同,例如,推送机制提议的HTTP/2规范通过将请求和响应的标头组合在一起而起作用.
Requests headers are distinct from response headers, such that the push mechanism defined in the proposed HTTP/2 spec works by combining together the headers of the request and response.
您应该查看 AJAX/Comet ,因为它实质上实现了您所描述的内容:客户端应用程序定义了一种接收任何类型的游戏动作的方法,然后服务器指定每次按下时发生的动作.
You should look at AJAX/Comet because it essentially implements what you describe: the client-side application defines a method to receive any kind of game action, and then the server specifies which action occurred for each push.
更多推荐
HTTP请求源自HTTP服务器
发布评论