473,651 Members | 3,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XMLHttpRequest( ) and persistent connections

I have a web app, written in Javascript, that communicates to a back-end
server via XMLHttpRequest.

The logic goes:

* Login
* Perform transaction
* (delay while the user does something)
* Perform transaction
* ...
* Logout

It would be really convenient if I could make the whole thing a single HTTP
connection. That way, I avoid needing IPC and session management at the
server end, and a single instance of a CGI script can represent the entire
session. When the socket gets closed, the CGI script terminates and
implicitly logs the user off. All very simple.

Can I use HTTP pipelining with XMLHttpRequest to do this? The docs seem to
say (it's quite hard to tell) that I have to call open() after each send(),
which will presumably create a new HTTP session. Can I 'persuade' the
browser to reuse an existing session?

--
+- David Given --McQ-+
| dg@cowlark.com | "I have a mind like a steel trap. It's rusty and
| (dg@tao-group.com) | full of dead mice." --- Anonymous, on rasfc
+- www.cowlark.com --+

Jul 23 '05 #1
3 8569


David Given wrote:
I have a web app, written in Javascript, that communicates to a back-end
server via XMLHttpRequest.

The logic goes:

* Login
* Perform transaction
* (delay while the user does something)
* Perform transaction
* ...
* Logout

It would be really convenient if I could make the whole thing a single HTTP
connection.


It might be that XMLHttpRequest in Mozilla has a feature for some time
now that could help, see
<https://bugzilla.mozill a.org/show_bug.cgi?id =237319>
that is fixed and added support for multipart/x-mixed-replace.
I haven't used that but what I have read there comes close to what you
describe above.
But given the limited implementations of XMLHttpRequest in Opera or
Safari so far I have doubts it will work there.
Not sure whether MSXML/IE can handle that.

Please report back to the group whether that multipart/x-mixed-replace
feature of XMLHttpRequest in Mozilla is useful for you.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen wrote:
[...]
Please report back to the group whether that multipart/x-mixed-replace
feature of XMLHttpRequest in Mozilla is useful for you.


I've had a look at that; it allows the server to send multiple responses
back to the client down the same HTTP session, but I don't know if it
allows multiple two-way *transactions* down the same HTTP session.

--
+- David Given --McQ-+ "Apatheism: the school of belief where on doesn't
| dg@cowlark.com | particularly care if there is/are god(s)." ---
| (dg@tao-group.com) | Capt. Gym Z. Quirk
+- www.cowlark.com --+

Jul 23 '05 #3


David Given wrote:
Martin Honnen wrote:
Please report back to the group whether that multipart/x-mixed-replace
feature of XMLHttpRequest in Mozilla is useful for you.

it allows the server to send multiple responses
back to the client down the same HTTP session, but I don't know if it
allows multiple two-way *transactions* down the same HTTP session.


In my understanding the client with XMLHttpRequest will do one request
and then be able to receive multiple responses but indeed multiple
two-way exchange is not possible that way.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

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

Similar topics

3
2785
by: Randell D. | last post by:
Folks, I currently connect to my db with PHP code that uses non-persistent connections. I've read that persistent connections can help performance since a connection to the db will use an existing unused connection. If my system was to go through a busy period whereby I seen an extra 50% or more activity for ten minutes or so, would the extra connections stay alive for ever or is there a time limit of inactivity? Would the unused...
2
8513
by: Steve Jenkins | last post by:
Wonder if anyone can help. So, I've read: >> http://uk2.php.net/function.mysql-pconnect >> http://uk2.php.net/manual/en/features.persistent-connections.php Can one seriously see persistent connections as a form of db connection pooling? Is it really similar? Thanks for any clarification from anyone,
4
4395
by: M. Katz | last post by:
I'm relatively new to PHP/MySQL and I've heard about maintaining a persistent connection to the database. To save overhead, I'd like to maintain the connection in a session variable, but I have a few questions first. I'm able to establish session variables and test them with isset() to avoid re-defining them with each new web-page load. So is this really as simple as if (!isset($_SESSION)) {
5
2806
by: Felix E. Klee | last post by:
I've set up a PHP web application where users can log in and open a connection to a NNTP-server. There is a *one-to-one* relationship between sessions and NNTP-connections (i.e. exactly one NNTP-connection per session, and exactly one session per NNTP-connection). Now, I'd like to have these connections be persistent. So I started using "pfsockopen" instead of "fsockopen" and set Apache's KeepAliveTimeout to a very high value. ...
1
3326
by: Chris Spencer | last post by:
I noticed the SimpleXMLRPCServer/ServerProxy creates a new socket for remote procedure call. I've written a simple IP based authentication scheme for the Server, and I'd like to include the port in the authentication, which is currently not possible since the port keeps changing. I've looked at the code in SimpleXMLRPCServer.py, xmlrpclib.py, SocketServer.py, and BaseHTTPServer.py, but it's a little overwhelming. How difficult would it...
2
2023
by: David Haynes | last post by:
If I do $conn = new msqli(...); do I automatically get persistent connections? If not, how do I get them? Fall back to pconnect()? -david-
2
2989
by: Jim Hubbard | last post by:
Is it possible to have persistent connections in ASP.Net?
0
881
by: manji | last post by:
I had a problem with persistent connections and had to disable in on the webserver. Now i found out that the ASP.net debugger will not function if persistent connections are disabled. I hope Microsoft would put this in their debugger help file, it may save some people some trouble and headache in the future.
1
1879
by: Paul Wagstaff | last post by:
Access 03 Runtime / Win XP Hi folks I wonder if I can tap the wizards for some general advice.. What are the risks/penalities/drawbacks for having a persistent connection to a back-end mdb? thanks in advance, Paul
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.