Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / March 2005



Tip: Looking for answers? Try searching our database.

How to implement server push operation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vanitha@agilis.st.com.sg - 31 Mar 2005 04:11 GMT
I am developing a Web Interface for a embedded target using CGI-C. I
have a requirement, which requires a HTML page to be continuously
updated by the server.ie.,I am dynamically updating the fields of the
HTML page using Javascript. I generate the javascript code from "C".

I need to do the above operation as long as the user stays in the
Current Page. If the user has clicked some other page, i want to stop
the operation in the server. Is there a way to notify the server
process when the user clicks some other page.

I dont want implement this as client pull operation, since i had to do
some other processing in the server

Thanks
Fred Oz - 31 Mar 2005 07:14 GMT
> I am developing a Web Interface for a embedded target using CGI-C. I
> have a requirement, which requires a HTML page to be continuously
[quoted text clipped - 3 lines]
> I need to do the above operation as long as the user stays in the
> Current Page.

 You can't detect whether the user is 'in the current page', since
 'current page' has no meaning to the server.  I guess you you mean
 'whether the user is still displaying the last page that their UA
 requested from this server in one of their currently open windows or
 tabs'.

 All you can tell is whether a script you have installed in a page is
 still polling or not (as you appear to be doing already), you can't
 detect the 'current page' from the server, nor can you detect the URI
 of one page or tab from another (except perhaps in the very limited
 case of child windows opened by one of your pages).

>               If the user has clicked some other page, i want to stop
> the operation in the server. Is there a way to notify the server
> process when the user clicks some other page.

 Only if that 'other page' is on your server and the user clicks on
 your page to get there.

 Even if there was some event that on page unload or window/tab close
 would send some undisclosed information to the server, the user can
 kill their browser or stop communication with the server a number of
 ways that prevent the message ever getting through.

 To that extent, your attempt to create a session would be extremely
 unreliable to the point of being useless.

> I dont want implement this as client pull operation, since i had to do
> some other processing in the server

 From the HTTP 1.1 specification:

Abstract

   The Hypertext Transfer Protocol (HTTP) is an application-level
   protocol for distributed, collaborative, hypermedia information
   systems. It is a generic, stateless, protocol which can be used for
   many tasks beyond its use for hypertext,

...

1.4 Overall Operation

   The HTTP protocol is a request/response protocol. A client sends a
   request to the server...

   <URL:ftp://ftp.isi.edu/in-notes/rfc2616.txt>

 In brief, HTTP is stateless, so the client and server only
 communicate when asked to - there is no maintenance of a connection
 or concept of a 'session'.  HTTP is based on a client requesting
 information, not the server deciding to sent it.

 You may be able to use a script that is called at regular intervals
 to poll the server and retrieve content at some specified interval,
 but you can't do the reverse, i.e. get the server to poll the client
 to see if it wants more information.

 If your server does not get a request within some multiple of the
 interval, you may presume that the user has 'left the page' and
 terminate their session (as is done by many secure sites like banks
 and stock brokers).

Signature

Fred

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.