Generally with HTTP, you would configure your server to continue to respond
to requests;)  Which is exactly what django does anyway.

HTTP is a connection based (TCP) protocol, but the connection is closed once
the return has been sent.  Hence the need to store a 'session' variable in
the server and use a cookie on the browser with a corresponding session id.
Data does not live beyond the request.  You cannot define a variable within
your django view or Apache process and pass it back to the client on the
next request.  You can only put a variable within a session record, at which
point it goes out of memory for all useful purposes, and then put the
variable back into memory from the session record on the next request
matching the session id.

AFAIK (and I *think* I understand TCP/IP/HTTP fairly well) there is no way
to have an HTTP server initiate a connection to a browser.  Browsers (HTTP
Clients) do not listen on TCP ports for incoming requests, otherwise, they
would be HTTP servers.

As far as streaming (in the video sense), over http, you are just
downloading a file, albeit usually a really big one, via HTTP and the player
makes it play before the download is finished.  It really is though nothing
more than a 'single' response, in the sense that once the file is done
downloading the request is terminated.

Now, this is a pretty simple explanation of how this works, in reality when
you request a web page, you usually are getting more than one file (hence
more than one request/response), as all external files (css, js, images
etc...) referenced on a page will be requested by the browser as well. But
the browser does the requesting.  Look at your Django console messages and
you'll see this.

It is however, possible to have a javascript function request information
asynchronously or request a page refresh (oh the horror) at a given
interval of time.  This is how many sites implement live coverage of events,
like Apple's WWDC. Perhaps if you explained a bit more of what you are
trying to accomplish, someone may be able to suggest some javascript library
or function that can do this...
hth,
-richard



On 6/25/08, RossGK <[EMAIL PROTECTED]> wrote:
>
>
> In a simple XMLhttpRequest I can do an ajax request for some data,
> have django look something up and send it to my browser.
>
> Is the response from the views.py always just a single response
>
>    return render_to_response('my_index.html', {'all_data': all_data})
>
> or is there some means to do either of the following:
>
> a) return multiple responses for the next hour
> b) start streaming something to the client.
>
> I'm new to this, but I've only come across the idea of a single
> response to each request.   How would one approach kicking off
> something that continues to feed responses?
>
> Thanks for any ideas on this...
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to