I would like to put a basic question about browser to the experts.
I can use a browser to connect to HTML server to request some data,
which then is displayed on the browser. If the server now updates his
data once in a while, e.g. a webcam, the browser has to request
periodically the new data due to my understanding.
Sort of polling of the server.
Is very any way for a server to send unrequested (independent of requests) data to a browser after a first initial request. The data
should then subsequently updated on the browser.
No. HTTP is a stateless request/response protocol. You can do that kind of thing with applets but the protocol used for the applet/server communication will not be HTTP.
The last few weeks I have searched the web and the HTTP protocol for solutions of this problem. In my opinion, this missing feature is a
serious shortcoming of this protocol.
All the applet stuff will only complicate the whole thing on the server and also on the client side.
That all depends on what you want to continually send to the browser. If you're talking about video, you should read up on streaming video. If you just want an HTML page to update, then you're out of luck. Just place a note on the page for users to refresh frequently to download the latest version.
What are you trying to accomplish? If data is changing frequently, you might also look into a content management system, where you keep your main content of a page in a data base and use a server-side language like PHP, ASP, or JSP to dynamically create pages each time a user requests a page.
But like I said, this all depends on what you're trying to accomplish.
The last few weeks I have searched the web and the HTTP protocol for solutions of this problem. In my opinion, this missing feature is a
serious shortcoming of this protocol.
All the applet stuff will only complicate the whole thing on the server and also on the client side.
The way http protocol is now is secure. Communication between the client and server exists when the client sends a request tot he server, server request referer user agent so on and so fourth, the server sends data to the user. The client can then communicate back up to the server through a form post. There is no continuous communication between the two though. For a stream server though there is a constantly open socket, the client request the stream and the stream server sends it. Either way the socket cannot just close up like normal on http and then open right when the client is clicking on your menu or whatever so the server side script can run and new code be sent to the user seamlessly... when the user clicks on the menu maybe the top of the menu is a link with a query string and a whole new page of html is sent to the client with the new menu code in it, so the page is effectively refreshed. It is more simple and more secure this way. The socket connection cannot be both open and closed at the same time to where it can just send data on demand like it sounds like you were looking for... the socket is not schrodinger's cat.
What exactly are you trying to do? Maybe we can help you brainstorm to find an alternative method.
Originally posted by marcaurel
The last few weeks I have searched the web and the HTTP protocol for solutions of this problem. In my opinion, this missing feature is a
serious shortcoming of this protocol.
It's not a "shortcoming"; that's just not the purpose of HTTP. If there's nothing that fits then you can roll your own starting with telnet as the basic transport.
Originally posted by ray326 It's not a "shortcoming"; that's just not the purpose of HTTP. If there's nothing that fits then you can roll your own starting with telnet as the basic transport.
Okay brainiac... not all of us invented the internet!
Tell me more about this custom protocol stuff? You piqued my interest.
"What exactly are you trying to do? Maybe we can help you brainstorm to find an alternative method."
What I am looking for is, how to connect from a browser to a HTTP server somewhere in a LAN or in a WAN and watch some changing data on the server continuously. Without clicking the reload button on the browser.
Since HTTP is a request-based protocol (the client always initiates the communication, not the server), probably the easiest way to do this is simply refresh fairly rapidly and automatically, repeatedly polling the server as you described. It's not a shortcoming of the protocol, simply that you are using it for something other than its intended purpose.
@AdamGundry
The two links are looking quite good. Thanks.
"Okay brainiac... not all of us invented the internet!"
Sometimes I start to dream a little bit. What would be the problem
with some "telnet" features in standard browsers? Or what about an application server in a LAN and everybody can work on the server with various applications using the IE, opera, mozilla or firefox as frontend? Sorry. I am daydreaming again.
Originally posted by marcaurel Or what about an application server in a LAN and everybody can work on the server with various applications using the IE, opera, mozilla or firefox as frontend? Sorry. I am daydreaming again.
You're not entirely day dreaming again. I'm sure you could create a Java applet would be the way to go then (as mentioned before). You can use a META refresh tag in the HTML document too.
In my opinion, the problem is the mixture of various tools. Scripting, plugins, java applets and so on. Each of them needs special environments, settings, installation procedures, maybe maintenance and so on. This makes the whole stuff quite unreliable due to my experience.
Too many dependencies of tools, which are beyond of my control.
Originally posted by PeOfEo Tell me more about this custom protocol stuff? You piqued my interest.
Well just look at how HTTP, SMTP, FTP and others work. They all use Telnet as the transport for an easy to use, text-based protocol specific to some communication problem. (FTP is a little different in that it opens two connections, but the "command" connection is simply Telnet.) I know your familiar with this stuff but for those that aren't, here's how to be a simple web browser.
telnet google.com 80
GET / HTTP/1.0
You hit two enters after the second line and Google will respond with something like so (abridged).
The HTTP (response) protocol is really those first lines before the <html>. The request protocol is what you typed into telnet. Telnet runs the Internet!
Originally posted by AdamGundry Since HTTP is a request-based protocol (the client always initiates the communication, not the server), probably the easiest way to do this is simply refresh fairly rapidly and automatically, repeatedly polling the server as you described. It's not a shortcoming of the protocol, simply that you are using it for something other than its intended purpose.
P.S. Peo, that is the first time I've seen Schrodinger's cat mentioned in a post on this site.
A meta refresh would work too wouldn't it? I have seen schrodinger's cat mentioned in the coffee lounge once. It was inreference to the thing about
Schrodinger's Cat is <blink>Not</blink> Dead.
Originally posted by ray326 Well just look at how HTTP, SMTP, FTP and others work. They all use Telnet as the transport for an easy to use, text-based protocol specific to some communication problem. (FTP is a little different in that it opens two connections, but the "command" connection is simply Telnet.) I know your familiar with this stuff but for those that aren't, here's how to be a simple web browser.
telnet google.com 80
GET / HTTP/1.0
You hit two enters after the second line and Google will respond with something like so (abridged).
The HTTP (response) protocol is really those first lines before the <html>. The request protocol is what you typed into telnet. Telnet runs the Internet!
I am still confused at how you would get the server to give you a continuous stream of data though. I would have to look into how rtsp or something else works maybe if I were trying to do this.
Bookmarks