www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: Basic question about browser

  1. #1
    Join Date
    Dec 2004
    Posts
    9

    Basic question about browser

    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.

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    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.

  3. #3
    Join Date
    Dec 2004
    Posts
    9

    +

    Thanks.

    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.

  4. #4
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,774
    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.

  5. #5
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222

    Re: +

    Originally posted by marcaurel
    Thanks.

    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.
    Last edited by PeOfEo; 12-26-2004 at 02:08 PM.

  6. #6
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715

    Re: +

    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.

  7. #7
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222

    Re: Re: +

    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.

  8. #8
    Join Date
    Dec 2004
    Posts
    9

    +

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

    I know, I am a lazy guy.
    Last edited by marcaurel; 12-27-2004 at 08:20 AM.

  9. #9
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    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.

    JavaScript can be used to automate polling the server, either by refreshing the whole page or downloading data using XMLHttpRequest.

    Adam

    P.S. Peo, that is the first time I've seen Schrodinger's cat mentioned in a post on this site.

  10. #10
    Join Date
    Dec 2004
    Posts
    9
    @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.

  11. #11
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,774
    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.

  12. #12
    Join Date
    Dec 2004
    Posts
    9

    +

    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.

  13. #13
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715

    Re: Re: Re: +

    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).
    Code:
    HTTP/1.0 200 OK
    Cache-Control: private
    Content-Type: text/html
    Set-Cookie: PREF=ID=bc41abdf5cd2dbe9:TM=1104169961:LM=1104169961:S=r28xhW8Fo363n
    v5J; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
    Server: GWS/2.1
    Date: Mon, 27 Dec 2004 17:52:41 GMT
    Connection: Close
    
    <html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859
    -1"><title>Google</title>
    . . .
    </head><body bgcolor=#ffffff text=#000000 lin
    k=#0000cc vlink=#551a8b alink=#ff0000 onLoad=sf()>
    . . .
    </body></html>
    
    Connection to host lost.
    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!

  14. #14
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    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.

    JavaScript can be used to automate polling the server, either by refreshing the whole page or downloading data using XMLHttpRequest.

    Adam

    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.

    edit: Oh wait, meta was said already.

  15. #15
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222

    Re: Re: Re: Re: +

    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).
    Code:
    HTTP/1.0 200 OK
    Cache-Control: private
    Content-Type: text/html
    Set-Cookie: PREF=ID=bc41abdf5cd2dbe9:TM=1104169961:LM=1104169961:S=r28xhW8Fo363n
    v5J; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
    Server: GWS/2.1
    Date: Mon, 27 Dec 2004 17:52:41 GMT
    Connection: Close
    
    <html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859
    -1"><title>Google</title>
    . . .
    </head><body bgcolor=#ffffff text=#000000 lin
    k=#0000cc vlink=#551a8b alink=#ff0000 onLoad=sf()>
    . . .
    </body></html>
    
    Connection to host lost.
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles