473,372 Members | 865 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,372 software developers and data experts.

How to hit a server in the background?

We're designing a web app in which some operations will take a long time
to complete (maybe two minutes). Because it's a high-volume application,
we don't want browser connections hanging open for these two-minute
intervals; that would cause a huge resource drain on the server (open
threads, etc.).

We've implemented a page which has a <meta refresh> tag in it of 15
seconds, so that the browser can "check back" with the server every so
often to see if it's done with this operation.

However, we don't like the constant page reloading.. We'd rather script
this as a javascript "background process" if this is possible...

My question is, is there a way to script some kind of page reload in
Javascript, which is done without any visible window on the screen? I'd
script it to reload every 15 seconds or so, until (for example) the text
"OK" appears in the <body> tag (or some other indicator), which would
then signal the main page to reload.

Sorry if this is a tortuously confusing question. Appreciate it if you
got this far and can offer any suggestions.
--

Bryan Field-Elliot
http://netmeme.org

Jul 20 '05 #1
5 4575
I'd like to see more pages doing this kind of thing.

One thing you can do is to have an IFrame and set its source to be something like
mydomain.com/perhaps/a/directory/statusChecker.php?some=arguments&go=here

On the server side, you will then realize that this is a directive to check some status.
If it's ready, return appropriate data, otherwise send back a not ready message.
This sending back data/message is actually a page which has an onLoad
which knows about its container document (the original page)
and can access the necessary functions.

You'll have timing issues (but then again, that's your whole
reason for doing this). In particular, You'll have to have some
timeout and set semaphores in case the server or connection
goes belly up, or the response time is longer than expected
and then returning.

Good luck,
Csaba Gabor from New York

PS. You can do one way communication by setting the src on
IMAGE elements, but you have said that you actually want
returned information.
You would think that you could just load a new SCRIPT element
instead of needing to suck up pages, but I have not gotten this
to work, especially cross platform. I'd be happy to read about
other peoples' approaches.
"Bryan Field-Elliot" <br***@netmeme.org> wrote in message news:3LQ9b.481514$o%2.214880@sccrnsc02...
We're designing a web app in which some operations will take a long time
to complete (maybe two minutes). Because it's a high-volume application,
we don't want browser connections hanging open for these two-minute
intervals; that would cause a huge resource drain on the server (open
threads, etc.).

We've implemented a page which has a <meta refresh> tag in it of 15
seconds, so that the browser can "check back" with the server every so
often to see if it's done with this operation.

However, we don't like the constant page reloading.. We'd rather script
this as a javascript "background process" if this is possible...

My question is, is there a way to script some kind of page reload in
Javascript, which is done without any visible window on the screen? I'd
script it to reload every 15 seconds or so, until (for example) the text
"OK" appears in the <body> tag (or some other indicator), which would
then signal the main page to reload.

Sorry if this is a tortuously confusing question. Appreciate it if you
got this far and can offer any suggestions.
--

Bryan Field-Elliot
http://netmeme.org

Jul 20 '05 #2
This is clever, thank you. The returned "Status" document can contain
the javascript needed to cause the parent to reload (after the server is
done processing). Nice!

So I guess the last follow-on question is, if an IFRAME has a width and
a height of "0", does it cause any funny stuff to happen in any of the
popular browsers, or is it fine?
--

Bryan Field-Elliot
http://netmeme.org


Csaba2000 wrote:
I'd like to see more pages doing this kind of thing.

One thing you can do is to have an IFrame and set its source to be something like
mydomain.com/perhaps/a/directory/statusChecker.php?some=arguments&go=here

On the server side, you will then realize that this is a directive to check some status.
If it's ready, return appropriate data, otherwise send back a not ready message.
This sending back data/message is actually a page which has an onLoad
which knows about its container document (the original page)
and can access the necessary functions.

You'll have timing issues (but then again, that's your whole
reason for doing this). In particular, You'll have to have some
timeout and set semaphores in case the server or connection
goes belly up, or the response time is longer than expected
and then returning.

Good luck,
Csaba Gabor from New York

PS. You can do one way communication by setting the src on
IMAGE elements, but you have said that you actually want
returned information.
You would think that you could just load a new SCRIPT element
instead of needing to suck up pages, but I have not gotten this
to work, especially cross platform. I'd be happy to read about
other peoples' approaches.
"Bryan Field-Elliot" <br***@netmeme.org> wrote in message news:3LQ9b.481514$o%2.214880@sccrnsc02...
We're designing a web app in which some operations will take a long time
to complete (maybe two minutes). Because it's a high-volume application,
we don't want browser connections hanging open for these two-minute
intervals; that would cause a huge resource drain on the server (open
threads, etc.).

We've implemented a page which has a <meta refresh> tag in it of 15
seconds, so that the browser can "check back" with the server every so
often to see if it's done with this operation.

However, we don't like the constant page reloading.. We'd rather script
this as a javascript "background process" if this is possible...

My question is, is there a way to script some kind of page reload in
Javascript, which is done without any visible window on the screen? I'd
script it to reload every 15 seconds or so, until (for example) the text
"OK" appears in the <body> tag (or some other indicator), which would
then signal the main page to reload.

Sorry if this is a tortuously confusing question. Appreciate it if you
got this far and can offer any suggestions.
--

Bryan Field-Elliot
http://netmeme.org



Jul 20 '05 #3
"Bryan Field-Elliot" <br***@netmeme.org> wrote in message news:0r*******************@rwcrnsc52.ops.asp.att.n et...
This is clever, thank you. The returned "Status" document can contain
the javascript needed to cause the parent to reload (after the server is
done processing). Nice!
Or, the returned "Status" document can contain the javascript needed to
REPAINT or reconfigure the page, IF there is not much change, which
will reduce the amount of flicker the user sees
So I guess the last follow-on question is, if an IFRAME has a width and
a height of "0", does it cause any funny stuff to happen in any of the
popular browsers, or is it fine?
I seem to recollect that there are some issues with the visibility of the
IFrame, but I don't remember details. One option is to set
..style.display="none" on it. If I remember right, trying to set
focus to one of its elements when the element is not visible hangs
the page on one browser (probably NN), but I'm not sure on that.
The upshot is, you'll have to be on the lookout for issues.
Also, didn't I see that Opera allows you to permit inline frames
or not - but frankly, even if true, I think market share on this
is so small you needn't worry.

Csaba

PS. I almost forgot another idea (but I like the IFrame one better).
I think (I'm not sure - my testing was a while ago), that you could
set cookies when sending information by means of altering
the src on an IMAGE element. This would allow passive
(where the returned data can't notify the requester - which is
why I'd use the IFrame) communication of limited size. It doesn't
strike me as being structurally more simple, however, than
the IFRAME scheme.
--

Bryan Field-Elliot
http://netmeme.org


Csaba2000 wrote:
I'd like to see more pages doing this kind of thing.

One thing you can do is to have an IFrame and set its source to be something like
mydomain.com/perhaps/a/directory/statusChecker.php?some=arguments&go=here

On the server side, you will then realize that this is a directive to check some status.
If it's ready, return appropriate data, otherwise send back a not ready message.
This sending back data/message is actually a page which has an onLoad
which knows about its container document (the original page)
and can access the necessary functions.

You'll have timing issues (but then again, that's your whole
reason for doing this). In particular, You'll have to have some
timeout and set semaphores in case the server or connection
goes belly up, or the response time is longer than expected
and then returning.

Good luck,
Csaba Gabor from New York

PS. You can do one way communication by setting the src on
IMAGE elements, but you have said that you actually want
returned information.
You would think that you could just load a new SCRIPT element
instead of needing to suck up pages, but I have not gotten this
to work, especially cross platform. I'd be happy to read about
other peoples' approaches.
"Bryan Field-Elliot" <br***@netmeme.org> wrote in message news:3LQ9b.481514$o%2.214880@sccrnsc02...
We're designing a web app in which some operations will take a long time
to complete (maybe two minutes). Because it's a high-volume application,
we don't want browser connections hanging open for these two-minute
intervals; that would cause a huge resource drain on the server (open
threads, etc.).

We've implemented a page which has a <meta refresh> tag in it of 15
seconds, so that the browser can "check back" with the server every so
often to see if it's done with this operation.

However, we don't like the constant page reloading.. We'd rather script
this as a javascript "background process" if this is possible...

My question is, is there a way to script some kind of page reload in
Javascript, which is done without any visible window on the screen? I'd
script it to reload every 15 seconds or so, until (for example) the text
"OK" appears in the <body> tag (or some other indicator), which would
then signal the main page to reload.

Sorry if this is a tortuously confusing question. Appreciate it if you
got this far and can offer any suggestions.
--

Bryan Field-Elliot
http://netmeme.org


Jul 20 '05 #4
Bryan Field-Elliot wrote:
We're designing a web app in which some operations will take a long time
to complete (maybe two minutes). Because it's a high-volume application,
we don't want browser connections hanging open for these two-minute
intervals; that would cause a huge resource drain on the server (open
threads, etc.).

We've implemented a page which has a <meta refresh> tag in it of 15
seconds, so that the browser can "check back" with the server every so
often to see if it's done with this operation.

However, we don't like the constant page reloading.. We'd rather script
this as a javascript "background process" if this is possible...

My question is, is there a way to script some kind of page reload in
Javascript, which is done without any visible window on the screen? I'd
script it to reload every 15 seconds or so, until (for example) the text
"OK" appears in the <body> tag (or some other indicator), which would
then signal the main page to reload.

[...]


Could the HTTPRequest object be useful for this?

http://jibbering.com/2002/4/httprequest.html

Regards,
Stephen

Jul 20 '05 #5
Hi all,

I have the same problem,

I need make a controler with javascript for background process.

My app registration values and take a 1 minutes if the user press f5 or button post
the process start again.

Can i controle this?

Thanks
Jul 28 '06 #6

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

Similar topics

4
by: Marek Kotowski | last post by:
The problem: I'd like to build – with PHP – a background-image url on a server (Apache) (url itself or a full directory name). I'd like to use a portable mechanism, I mean a PHP script should...
19
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2...
2
by: VB Programmer | last post by:
I only have 1 set of <FORM> tags in my HTML file, but I keep getting this error. Any ideas? *********** A page can have only one server-side Form tag. Description: An unhandled exception...
4
by: Weston Weems | last post by:
I've got the simple problem where I'd like to transfer somewhat large files to my webserver via http/webservice/something like that. My question is what kinda limits have people been able to...
4
by: frog | last post by:
Hi, all: I tried to call Server.Execute in Application_Start and got exception. Any help is appreciated You might ask why I want to do that in the first place. Well, I need to start a...
19
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However...
2
by: Patient Guy | last post by:
I don't think I have ever encountered something like this before. On a Windows XP running Apache 2.0.53 I do my page development (XP machine). I then upload the stuff to a Linux/Redhat/Fedora...
8
by: Maxwell2006 | last post by:
Hi, Using ASP.NET 2.0, I have this tag in my asp page: <td runat =server background="~/Images/Header2.gif">&nbsp;</td> The problem is when I run the page, the server side TD tag renders...
0
by: SYT | last post by:
Hello, I wrote C program for connecting to postgresSQL server to retrieve data from the postgres database. The program is: #include <stdio.h> #include <stdlib.h> #include "libpq-fe.h" int...
3
by: nathanwb | last post by:
I have the following code and at times, it seems at randome I get the SERVER 500 error.. any ideas? or may code tweaks? Thanks <? include('../application.php');...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.