Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14054

Re: XMLHttpRequest

Message-ID <2104344.5D107XkKLB@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-05-21 18:31 +0200
Subject Re: XMLHttpRequest
Newsgroups comp.lang.javascript
References <4fb77ae9$0$6925$e4fe514c@news2.news.xs4all.nl> <645cf917-7fb3-4a7b-9e36-8d03aa4ca965@x10g2000yqg.googlegroups.com> <4fba4b92$0$6961$e4fe514c@news2.news.xs4all.nl>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Tom de Neef wrote:

> "Scott Sauyet" <scott.sauyet@gmail.com> schreef in bericht
> news:645cf917-7fb3-4a7b-9e36-8d03aa4ca965@x10g2000yqg.googlegroups.com...
> Tom de Neef wrote:
>> I found a reference where it says that an open()
>> call will close requests still in progress but I can not find
>> confirmation.
> 
> Yes:
> 
> | Note: Calling this method an already active request (one for which
> | open() or openRequest()has already been called) is the equivalent
> of
> | calling abort().
>   -- Mozilla <https://developer.mozilla.org/en/XMLHttpRequest#open()>
> 
> and from the descriptio of the open() algorithm on a XMLHttpRequest
> object:
> 
> | 15. Terminate the send() algorithm.
>   - W3C <http://www.w3.org/TR/XMLHttpRequest/#the-open-method>

So you have evidence that it might be so in one DOM implementation because 
of one Working Draft (or vice-versa).  That does not mean anything for the 
rest of XHR-supporting runtime environments.

>> I imagine that the script is run in a single thread, so how are
>> successive calls to informServer handled by processAsyncResponse()?
> 
> Everything would proceed fine until a second open() call is made when
> the first is processing.
> 
> If you want to use a fixed pool of XMLHttpRequest objects (or even
> just one, as you are doing) then you really need to determine if the
> object is in process before you call open() again.
> 
> I've never really bothered.  Just constructing new instances has not
> caused me noticeable issues.
^^
(sic!)

Of course, creating new objects when not needed will unnecessarily consume 
resources that could be more useful elsewhere.  And as garbage collection is 
not performed instantly (if at all), one should be wary to create new 
objects.

> Thank you.
> Note PE's references: there is a limit (of two) to the number of
> XMLHttpRequest objects alive.

No, you misunderstood.  I have only pointed out that the number of 
simultaneous connections from the same HTTP client to the same HTTP server 
or proxy is supposed to be limited.  XHR merely provides an interface to the 
runtime environment's HTTP client.  I think we can accept as an axiom here 
that the number of XHR objects that can exist in a program simultaneously is 
– just like that of other objects – only limited by the amount of available 
memory.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

XMLHttpRequest "Tom de Neef" <tdeneef@qolor.nl> - 2012-05-19 12:50 +0200
  Re: XMLHttpRequest Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-20 23:29 +0200
    Re: XMLHttpRequest "Tom de Neef" <tdeneef@qolor.nl> - 2012-05-21 09:45 +0200
  Re: XMLHttpRequest Scott Sauyet <scott.sauyet@gmail.com> - 2012-05-21 06:26 -0700
    Re: XMLHttpRequest "Tom de Neef" <tdeneef@qolor.nl> - 2012-05-21 16:05 +0200
      Re: XMLHttpRequest Scott Sauyet <scott.sauyet@gmail.com> - 2012-05-21 09:01 -0700
      Re: XMLHttpRequest Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-21 18:31 +0200
        Re: XMLHttpRequest Scott Sauyet <scott.sauyet@gmail.com> - 2012-05-21 12:42 -0700

csiph-web