473,395 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to implement server push operation


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

Jul 23 '05 #1
1 1805
va*****@agilis.st.com.sg wrote:
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.
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).

--
Fred
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James R. Saker Jr. | last post by:
I've got a: "start server thread > Queue object, start server thread <> Queue object, start parsing client < Queue object" application that's got me puzzled. Probably an easy threads issue, but...
21
by: Morten Aune Lyrstad | last post by:
I wish to create my own assembly language for script. For now it is mostly for fun and for the sake of the learning, but I am also creating a game engine where I want this system in. Once the...
0
by: tatilou | last post by:
Hello, I need add new method to my properties. these methods should give me some attributes coming from my database. I think, to create a class with implement PropertyInfo but I don't know...
2
by: hakimks | last post by:
You are provided with a sample C programs: calc.c, which implements a reverse polish notation calculator. Study it carefully. This program uses a stack (of course!) but the stack implementation is...
2
by: sekitoleko | last post by:
This operation involves push/pop operations on a stack,arranging the smaller discs to sit on larger ones.How can I write a program to implement this?
52
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
5
by: ravi | last post by:
Can any body tell me How to implement a stack using two queues Thax in advance
139
by: ravi | last post by:
Hi can anybody tell me that which ds will be best suited to implement a hash table in C/C++ thanx. in advanced
2
by: ashore | last post by:
Folks, lots of stuff around re "multipart/x-mixed-replace" , which isn't supported on MS browsers. But i understand that they DO support an alternative server-push approach. I've Googled...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.