views:

273

answers:

6

As far as I'm concerned, Ajax provides a workaround for behaving like connection-oriented with HTTP protocol. But why wasn't HTTP protocol designed to be connection-oriended at first?

+2  A: 

For scalability reasons. Maintaining connections uses up resources.

ozczecho
+2  A: 
  1. AJAX is NOT a workaround for behaving like connection oriented. It is to ensure that based on user interaction, you want to update only a PORTION of content on client side instead of getting the full markup again from the server. It does not establish a to-and-fro connection between your browser and the web server.

  2. If every server had a live connection with the every client the internet size would have got limited to a couple of millions of users.

Sesh
+7  A: 

Because it was intended to be used for things where connections do not make sense.

It was designed as a HyperText Transfer Protocol, which means its responsibility was simply to allow the sending of messages of the form "please send me document X", and "here is document X, as you requested".

What should such a protocol use a persistent connection for?

jalf
+1 for clarity and historical perspective. I still have my doubts about the wisdom of using the Web as an application platform.
cheduardo
A: 

I think the reasons are pretty simple - when http was created:

1) Most / all pages were static 2) With almost no commercial presence on the internet, it was assumed that links were as likely as not to be pointed to a different site.

So, static pages + non-local content = connection free protocol.

JeffP
+1  A: 

HTTP was originally and still is conectionless. AJAX simply makes use of modern browser's JavaScript capabilities to send XML (or often JSON) to the server without reloading the page.

As mentioned, the main reason is scalability. Maintaining an active connection for each viewer of the website would be incredibly resource-intensive. Also, the fact was that the original creators of HTTP did not envisage any need for a system with a maintained connection - the idea of HTTP was simply to send a textual response to a request and then finish.

Noldorin
HTTP is not connectionless. That implies UDP, not TCP. It is more accurate to say that HTTP v1.0 and earlier did not use persistent connections by default. HTTP v1.1 does use persistent connections by default, however.
Remy Lebeau - TeamB
Yes, that's basically what I mean. By default, and by nature, it's generally a connectionless protocol.
Noldorin
+5  A: 

And simplicity.

It was in retrospect probably not such a bad thing, as it means that HTTP is simple, which means it can be used for simple stuff easily. And you can use it for harder/more complex stuff that does need state by building layers on top of it.

It is exactly this simplicity that got HTTP widely adopted and made it attractive. If it was not simple, then it woud have been just another complex protpocol that n-one uses unless they have to. If you don't believe me, can you tell me why you don't write your ajax apps using say RPC for the comms and X11 for the display/rendering? :D

Remember HTTP was originally designed to implement a wiki like read/WRITE information store, not online stores, banking, word processors etc. I recall reading an interview with Tim Berniers-Lee where he was really happy that wikis were gaining wide spread acceptance as (to paraphrase) thats how he intended the web to work. In practise this did not happen on the wider web and most sites disable the HTTP PUT method that was intended to enable this functionality.

Jason Tan