Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
335 views
in Technique[技术] by (71.8m points)

HTTP Request originated from HTTP Server

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.

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).

Does the existing standard allows HTTP server to send HTTP request to its connected client?

Note: I am not looking at page refresh / other web or application protocols like AJAX...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are asking for a server push, and no, it is not supported by HTTP/1.1.

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...